Skip to content

Commit

Permalink
fix(@formatjs/intl-datetimeformat): hour off by one at the exact time…
Browse files Browse the repository at this point in the history
… that DST starts or ends. (#2173)

e.g. for UK, DST starts at 01:00 UTC
When DST starts at 01:00 UTC, the correct local time is 02:00, not 01:00. There is no local time with hour equal to 1 that day.
When DST ends at 01:00 UTC, the correct local time is 01:00, not 02:00. The hour starting at 01:00 repeats.
Fix #2170
  • Loading branch information
joncooke-sky committed Oct 2, 2020
1 parent 6e3e7d2 commit b6601da
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getApplicableZoneData(
let offset = 0;
let dst = false;
for (; i <= zoneData.length; i++) {
if (i === zoneData.length || zoneData[i][0] * 1e3 >= t) {
if (i === zoneData.length || zoneData[i][0] * 1e3 > t) {
[, , offset, dst] = zoneData[i - 1];
break;
}
Expand Down

0 comments on commit b6601da

Please sign in to comment.