Skip to content

Commit

Permalink
Clarified a code comment
Browse files Browse the repository at this point in the history
* Also updated to convert to the required timezone after applying the timezone from the pattern
  • Loading branch information
normanj-bitquill committed Jul 2, 2024
1 parent ee4ddf0 commit 27b016e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4009,7 +4009,8 @@ public static class DateFormatFunction {
static {
ZoneId zoneId;
try {
// Currently the parsed timestamps are expected to be in UTC
// Currently the parsed timestamps are expected to be the number of
// milliseconds since the epoch in UTC, with no timezone information
zoneId = ZoneId.of("UTC");
} catch (Exception e) {
zoneId = ZoneId.systemDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ private static ZonedDateTime constructDateTimeFromParts(Map<ChronoUnitEnum, Long
final int minutes = dateParts.getOrDefault(ChronoUnitEnum.TIMEZONE_MINUTES, 0L)
.intValue();

return ZonedDateTime.of(constructedDateTime, ZoneOffset.ofHoursMinutes(hours, minutes));
return ZonedDateTime.of(constructedDateTime, ZoneOffset.ofHoursMinutes(hours, minutes))
.withZoneSameInstant(zoneId);
}

return ZonedDateTime.of(constructedDateTime, zoneId);
Expand Down

0 comments on commit 27b016e

Please sign in to comment.