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

The moment-timezone get the time zone of Kazakhstan Asia/Almaty in January 2024 to the DST. #1102

Open
nomoreyou opened this issue Mar 11, 2024 · 1 comment

Comments

@nomoreyou
Copy link

Environment

hi @gilmoreorless i got a problem with moment-timezone and jdk. The performance of moment-timezone and JDK in processing Asia/Almaty time zones is different. Moment-timezone considers that January in Kazakhstan is in DST, and isDST is true, while JDK is false.
please help me

const moment = require('moment-timezone');

const m = moment.tz('2024-01-01 08:22:33','Asia/Almaty');
const is = m.isDST();

console.log('is----------',is); //true;

but jdk consider it's time is not DST time
image

Issue description

@gilmoreorless
Copy link
Member

Moment's isDST method has a warning in the documentation:

NOTE: This function is a HACK. moment has no way of knowing if a given time is in actual DST or not. Some time changes in a zone are DST related, some are not, and without complete timezone information it can't know.

Moment currently checks the winter and summer time, and if the offset matches the summer offset (and summer off is different than winter off), then it reports DST. This works in vast majority of cases, but as mentioned above, is not "correct" and won't work for all cases.

Because eastern Kazakhstan had a one-off change of time zone, the naive guessing in Moment is being tripped up and thinks it's a DST shift. Although it's unfortunate, it's not something we're likely to fix, given the maintenance-only status of the project.

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