Skip to content

Commit 36a9ea7

Browse files
committed
Correction of the handling of offset in gap/overlap for time-zones that stopped to use DST.
1 parent 7c08082 commit 36a9ea7

File tree

1 file changed

+6
-0
lines changed
  • graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins

1 file changed

+6
-0
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins/JSDate.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@ private static int getOffset(TimeZone timeZone, long t, boolean isUTC) {
428428

429429
// dstOffset = 0, look back by standard DST savings
430430
int dstSavings = timeZone.getDSTSavings();
431+
if (dstSavings == 0) {
432+
// getDSTSavings() returns 0 for some time-zones (like America/Sao_Paulo)
433+
// that stopped to use DST. Unfortunately, we may have a date that
434+
// used DST still => try to use the usual DST savings (1 hour)
435+
dstSavings = 3600000;
436+
}
431437
offset = getOffset(timeZone, date - dstSavings, fields);
432438
int dstOffset = offset - rawOffset;
433439
if (dstOffset != 0 && dstOffset != dstSavings) {

0 commit comments

Comments
 (0)