We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using formatToTimeZone to convert an absolute time value to a date/time localised to a timezone gives different results depending on system timezone.
formatToTimeZone
When converting an absolute number of milliseconds since epoch into an arbitrary timezone, I would not expect the local timezone to have any effect.
For example, compare system timezone as Europe/London:
Europe/London
$ TZ=Europe/London node > const {formatToTimeZone} = require('date-fns-timezone'); undefined > formatToTimeZone( 1585422000000, 'YYYY-MM-DDTHH:mm:ssZ', {timeZone: 'Pacific/Auckland'}) '2020-03-29T09:00:00+13:00'
with system timezone America/New_York:
America/New_York
$ TZ=America/New_York node > const {formatToTimeZone} = require('date-fns-timezone'); undefined > formatToTimeZone( 1585422000000, 'YYYY-MM-DDTHH:mm:ssZ', {timeZone: 'Pacific/Auckland'}) '2020-03-29T08:00:00+13:00'
The hour part is different : 09 vs 08
According to [1] the correct value is 08.
[1] https://www.epochconverter.com/timezones?q=1585422000000&tz=Pacific%2FAuckland
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Using
formatToTimeZone
to convert an absolute time value to a date/time localised to a timezone gives different results depending on system timezone.When converting an absolute number of milliseconds since epoch into an arbitrary timezone, I would not expect the local timezone to have any effect.
For example, compare system timezone as
Europe/London
:with system timezone
America/New_York
:The hour part is different : 09 vs 08
According to [1] the correct value is 08.
[1] https://www.epochconverter.com/timezones?q=1585422000000&tz=Pacific%2FAuckland
The text was updated successfully, but these errors were encountered: