Timezone startOf DST off-by-one
See original GitHub issueIn Australia DST ends on the 4th of April 2021.
Using the timezone plugin and v1.10.4 (latest):
- Getting the start of the day before this date (in DST) returns the correct value
- Getting the start of the day after this date (outside DST) returns an incorrect value.
dayjs.tz('2021-04-01 08:00', 'Australia/Melbourne').startOf('day').format()
// 2021-04-01T00:00:00+11:00 (correct)
dayjs.tz('2021-04-15 08:00', 'Australia/Melbourne').startOf('day').format()
// 2021-04-14T23:00:00+11:00 (incorrect)
Curiously, the changelog mentions this issue was fixed in v1.9.7, so I switched to 1.9.6 to test this and it seems to be working correctly:
dayjs.tz('2021-04-01 08:00', 'Australia/Melbourne').startOf('day').format()
// 2021-04-01T00:00:00+11:00 (correct)
dayjs.tz('2021-04-15 08:00', 'Australia/Melbourne').startOf('day').format()
// 2021-04-15T00:00:00+11:00 (correct)
Is anyone up for fixing this? I’ll throw a $100 bounty down. Surely there are some others who also need this fixed and want to add to the pool!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:16
- Comments:16
Top Results From Across the Web
KB914387: How to configure daylight saving time for Microsoft ...
Click Start, click Run, type control timedate.cpl,,/Z, and then press Enter. Click the Time Zone tab, select the (GMT-08:00 Pacific Time (US &...
Read more >Daylight Saving Time – DST – Summer Time - Time and Date
When clocks go forward one hour in the spring and back one hour in the fall, it's known as Daylight Saving Time (DST),...
Read more >Working With Time Zones And Daylight Savings Time (DST) In ...
The day after daylight savings time has been put into effect in Mountain time, the two time zones are off by one hour,...
Read more >Event Invite Time Shown is off by One Hour - Mozilla Support
The following is that start of the invite.ics file: ... that it is something to do with DST, but have no idea how...
Read more >Temporal Cookbook - TC39
See also Push back a launch date for an easier way to round up unconditionally to the next start of a month. Time...
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
No results found
Top Related Hashnode Post
No results found

@apm78 day-js timezone support is insanely broken.
The docs make it seem like timezone support is production ready but it’s literally a single ~80 line file that barely covers anything.
I’m not very knowledgeable with timezones so it’s hard for me to contribute, but strategically I think this repo should:
I spent literally weeks adding day-js to a new platform before realising these issues existed and then spent literally days swapping it back out for Moment.js
+1 on this, would have to have to revert to moment.js because of this!