Skip to content

Commit 402d913

Browse files
authored
Consider dates with date 00/00/0000 in the ctot method (#1081)
* Consider dates with date 00/00/0000 in the ctot method In PR 505 a change was made to return null in the ctot method when parsing dates with time threw ParseException. This caused problems when parsing dates with the format "00/00/0000" and valid time Issue 207698 * I consider the format 0000/00/00 * I consider format without empty space
1 parent 1e618ad commit 402d913

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

common/src/main/java/com/genexus/LocalUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,10 @@ private static boolean isNullTimeValue(String value, boolean isAMPM)
796796
}
797797
}
798798

799+
private static boolean isNullDateValue(String value) {
800+
return value.equals("00/00/00") || value.equals("00/00/0000") || value.equals("0000/00/00");
801+
}
802+
799803
public static void main(String arg[])
800804
{
801805
System.out.println(isNullDateTime(" / / 12 AM", 2, 1));
@@ -1091,7 +1095,7 @@ public Date ctotex(String date, int format)
10911095
{
10921096
//When parsing a date gives a ParseException we try with setLenient(true) to parse dates only with dates with
10931097
//daylighttime changes at 00:00 AM (Issue: 93038)
1094-
if (!isNullTimeValue(date.substring(date.indexOf(' ') + 1), false))
1098+
if (date.indexOf(' ') == -1 || !isNullTimeValue(date.substring(date.indexOf(' ') + 1), false) && !isNullDateValue(date.substring(0, date.indexOf(' '))))
10951099
return null;
10961100
df.setLenient(true);
10971101
try

0 commit comments

Comments
 (0)