iamkun / dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
https://day.js.org
MIT License
46.3k stars 2.27k forks source link

timezone output wrong result #2601

Open haruajsuru opened 4 months ago

haruajsuru commented 4 months ago

Describe the bug Demo code:

        let time = dayjs().tz('Asia/Ho_Chi_Minh');
        console.log('Asia/Ho_Chi_Minh: ' + time.format('HH:mm'));
        time = time.tz('Asia/Singapore');
        console.log('Asia/Singapore: ' + time.format('HH:mm'));

output:

Asia/Ho_Chi_Minh: 00:30
Asia/Singapore: 02:30

Expected behavior output:

Asia/Ho_Chi_Minh: 00:30
Asia/Singapore: 01:30

The differences should only be 1 hour. The same code used to result correct time but suddenly became incorrect

Information

haruajsuru commented 4 months ago

I suppect this error somehow connect with daylight saving, because it only come up during the the day that the clock change. Right now the function working correctly again.