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

Wrong currentTimeOffsetInMinutes & currentTimeFormat #251

Open
parekh-raj opened this issue Mar 18, 2022 · 1 comment
Open

Wrong currentTimeOffsetInMinutes & currentTimeFormat #251

parekh-raj opened this issue Mar 18, 2022 · 1 comment

Comments

@parekh-raj
Copy link

Please correct me if I'm wrong. 😇

I took an example of timezone America/Matamoros.

Context
I used getTimeZones() function. For the above timezone(America/Matamoros), currentTimeOffsetInMinutes returns -360.
As you could see here that we had a DST on Sunday, March 13, 2022. So now it's UTC-5.

Question
Shouldn't it return -300 for currentTimeOffsetInMinutes?

Also the respective currentTimeFormat string is wrong. It's showing -06:00 ... instead of -05:00 ...

@vvo
Copy link
Owner

vvo commented Mar 20, 2022

Hey there @parekh-raj, this is unfortunate. I've dug into this issue many times and here's how it works:

tzdb (this package) does an Intl.DateTimeFormat call to get the current time zone information for a zone. This call itself then use any version of the timezone database available inside Node.js.

So it really depends how up-to-date your Node.js version is. And even that, the latest Node.js version (17.7.2) is not completely up to date with the latest tzdata version (lagging two versions behind).

I am not sure there's a way to solve this easily. Maybe @eblokhin since you touched a bit on this subject you have some thoughts?

Thanks!

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

No branches or pull requests

2 participants