Timezone conversion incorrect when daylight saving in effect
See original GitHub issueDescribe the bug Dayjs does not seem to convert timezone correctly when DST is in effect. It produces different results from Moment. The Moment results seem intuitively what I’d expect, so believe to be correct unless there is some subtlety I’m missing.
Expected behavior With this code:
const when = '2020-07-30T12:00:00+00:00'; // Midday GMT in summer
console.log('Moment London: ' + moment(when).tz('Europe/London').format('HH:mm Z'));
console.log('Moment New York: ' + moment(when).tz('America/New_York').format('HH:mm Z'));
console.log('Dayjs London: ' + dayjs(when).tz('Europe/London').format('HH:mm Z'));
console.log('Dayjs New York: ' + dayjs(when).tz('America/New_York').format('HH:mm Z'));
The output is:
Moment London: 13:00 +01:00
Moment New York: 08:00 -04:00
Dayjs London: 12:00 +00:00 // Expect 13:00 +01:00
Dayjs New York: 08:00 -05:00 // Expect 08:00 -04:00
Information
- Day.js: v1.9.6
- OS: Windows 10 Home
- Nodejs: v12.8.3
- Time zone: GMT+00:00
Issue Analytics
- State:
- Created 3 years ago
- Reactions:19
- Comments:19
Top Results From Across the Web
Time zones that do not observe daylight saving time - Outlook
In the Time zone list, select a time zone that does not observe daylight saving time and has the same UTC offset as...
Read more >The easy way to deal with time zones and daylight savings time
YES! Say so long to conditional conditions that subtract an amount of time based on the date; AT TIME ZONE handles the switch...
Read more >Daylight saving time and time zone best practices [closed]
The best advice is to stay away from local times as much as possible and stick to UTC where you can. Only convert...
Read more >Storing Date/Time as UTC, problem with daylight savings time
If they are traveling, they just change the timezone in their profile and all dates adjust to new timezone + daylight savings time...
Read more >Converting DATETIME and DATETIME-TZ from UTC to ...
On dates of daylight saving start, during daylight saving hours, converted time is incorrect. On dates of daylight saving end, during daylight ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found

The problem is still relevant.
a year and a half after this bug was reported and it’s still no fixed? damn… should i revert to momentjs after all?