You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In short the following returns a Date object for the 24th not 23rd:
utcToZonedTime(
new Date('Thu Jan 23 2020 05:00:00 GMT+0000 (Greenwich Mean Time)'),
'America/New_York' // -5 hours
);
It seems to happen when the inputted time matches the offset of the timezone. So if you move the time of the inputted date an hour back or forward, so it's different to the timezone offset, both utcToZonedTime and the native method return the same.
It's specifically related to do with Intl.DateTimeFormat which is used in tzTokenizeDate.
From #38, which was prematurely closed by its author. Here I'm pasting and editing relevant parts from #38.
The issue appears to exist on Chrome versions 80 and above. Relevant Chrome bug report, which has been closed and marked as WON'T FIX: https://bugs.chromium.org/p/chromium/issues/detail?id=1045791
An example of the problem: https://codepen.io/atomcorp/pen/gObqoyX
In short the following returns a Date object for the 24th not 23rd:
It seems to happen when the inputted time matches the offset of the timezone. So if you move the time of the inputted date an hour back or forward, so it's different to the timezone offset, both utcToZonedTime and the native method return the same.
It's specifically related to do with Intl.DateTimeFormat which is used in tzTokenizeDate.
Example: https://codepen.io/atomcorp/pen/bGNZzZz
The text was updated successfully, but these errors were encountered: