You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let startOfDayUnmodified = dayjs().startOf('day');
// $d: Tue Nov 09 2021 00:00:00 GMT-0700 (Mountain Standard Time)
let startOfDayWithAdd = dayjs().startOf('day').add(-7, 'days');
// $d: Tue Nov 02 2021 00:00:00 GMT-0600 (Mountain Daylight Time)
Edited after futher investigation:
When adding or subtracting time across the DST transition, the outputted dayjs has the timezone for the output time. This isn't technically wrong, the underlying time since epoch is correct, but it feels unexpected. I would expect the specified input timezone to match the output, regardless of the DST boundary.
Expected behavior
Adding or subtracting from a dayjs should yield the result in the input timezone:
let startOfDayUnmodified = dayjs().startOf('day');
// $d: Tue Nov 09 2021 00:00:00 GMT-0700 (Mountain Standard Time)
let startOfDayWithAdd = dayjs().startOf('day').add(-7, 'days');
// $d: Tue Nov 02 2021 01:00:00 GMT-0700 (Mountain Standard Time)
(Note, that I realize this may be subjective. I'm happy that I found the underlying object to still have the correct time since epoch, but my preference would be to change the behavior to use a consistent timezone.)
Information
Day.js Version 1.10.7
OS: Windows
Browser: Chrome 95, firefox
Time zone: GMT-07:00 MST (Mountain Standard Time)
The text was updated successfully, but these errors were encountered:
Describe the bug
I have the following code:
Edited after futher investigation:
When adding or subtracting time across the DST transition, the outputted dayjs has the timezone for the output time. This isn't technically wrong, the underlying time since epoch is correct, but it feels unexpected. I would expect the specified input timezone to match the output, regardless of the DST boundary.
Expected behavior
Adding or subtracting from a dayjs should yield the result in the input timezone:
(Note, that I realize this may be subjective. I'm happy that I found the underlying object to still have the correct time since epoch, but my preference would be to change the behavior to use a consistent timezone.)
Information
The text was updated successfully, but these errors were encountered: