Skip to content
New issue

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

formatInTimeZone considers DTS even on UTC when the env TZ has DTS #252

Open
gabrielbull opened this issue Sep 9, 2023 · 1 comment · May be fixed by #285
Open

formatInTimeZone considers DTS even on UTC when the env TZ has DTS #252

gabrielbull opened this issue Sep 9, 2023 · 1 comment · May be fixed by #285

Comments

@gabrielbull
Copy link

gabrielbull commented Sep 9, 2023

Consider this code in node:

process.env.TZ = "America/New_York";

const { parseISO } = require("date-fns");
const { formatInTimeZone } = require("date-fns-tz");

console.log(formatInTimeZone(parseISO("2024-03-09T02:00:00.000Z"), "UTC", "h:mm aaaa"));
console.log(formatInTimeZone(parseISO("2024-03-10T02:00:00.000Z"), "UTC", "h:mm aaaa"));

Outputs this:

2:00 a.m.
3:00 a.m.

But should output this:

2:00 a.m.
2:00 a.m.

The same issue is reproducible in the browser when the user has a timezone that has DTS.

@crhistianramirez
Copy link

I'm experiencing the same issue

@yangchristina yangchristina linked a pull request May 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants