Skip to content

Commit 2a1836e

Browse files
authored
When we did the refactoring the implementation of DateTimeToUTC with only one parameter was missed. (#46)
1 parent 407fb58 commit 2a1836e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

java/src/main/java/com/genexus/GXutil.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,23 @@ public static boolean emptyDate( Date value)
340340

341341
public static Date DateTimeToUTC(Date value)
342342
{
343-
return CommonUtil.DateTimeToUTC(value, TimeZone.getDefault());
343+
if ( emptyDate( value))
344+
return value;
345+
if (ModelContext.getModelContext() == null)
346+
{
347+
TimeZone tz = (TimeZone)com.genexus.GXutil.threadTimeZone.get();
348+
if (tz != null)
349+
return DateTimeToUTC(value, tz);
350+
else
351+
return DateTimeToUTC(value, TimeZone.getDefault());
352+
}
353+
else
354+
return DateTimeToUTC(value, ModelContext.getModelContext().getClientTimeZone());
344355
}
345356

346-
347357
public static Date DateTimeToUTC(Date value, TimeZone tz)
348358
{
349-
return CommonUtil.DateTimeToUTC(value, TimeZone.getDefault());
359+
return CommonUtil.DateTimeToUTC(value, tz);
350360
}
351361

352362
public static Date DateTimeFromUTC(Date value)

0 commit comments

Comments
 (0)