moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.82k stars 835 forks source link

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

Closed nomoreyou closed 3 months ago

nomoreyou commented 6 months ago

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 commented 5 months ago

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.

sslincoco commented 3 months ago

您的邮件已收到,我会尽快给您回复。

gilmoreorless commented 3 months ago

@sslincoco Please disable your email auto-responder for open source projects.