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
Describe the bug
Assigning the same utcOffset multiple times causes the formatted time to shift when the time is across a Daylight Savings Time boundary.
The following code demonstrates the issue:
constdayjs=require("dayjs");constutc=require("dayjs/plugin/utc");dayjs.extend(utc);console.table({// March 13th 2021 at 12:00PM -04:00 is during Standard Time// Force a specific timezone offset."13th 1xUTC offset": dayjs("2021-03-13T16:00:00.000Z").utcOffset(-4).format("h:mm A"),// Force a specific timezone offset multiple times. This should have no// effect, but unfortunately the formatted time shifts."13th 2xUTC offset": dayjs("2021-03-13T16:00:00.000Z").utcOffset(-4).utcOffset(-4).format("h:mm A"),// Force a specific timezone offset multiple times but reset in-between.// This has no effect and appears to be an adequte work-around."13th Change UTC offset": dayjs("2021-03-13T16:00:00.000Z").utcOffset(-4).utcOffset(0).utcOffset(-4).format("h:mm A"),// March 14th, 2021 at 12:00PM -04:00 is during Daylight Savings Time// Force a specific timezone offset."14th 1xUTC offset": dayjs("2021-03-14T16:00:00.000Z").utcOffset(-4).format("h:mm A"),// Force a specific timezone offset multiple times. This should have no// effect, but it's likely that the time would shift if tests are run during// standard time."14th 2xUTC offset": dayjs("2021-03-14T16:00:00.000Z").utcOffset(-4).utcOffset(-4).format("h:mm A"),// Force a specific timezone offset multiple times but reset in-between.// This has no effect and appears to be an adequte work-around."14th Change UTC offset": dayjs("2021-03-14T16:00:00.000Z").utcOffset(-4).utcOffset(0).utcOffset(-4).format("h:mm A"),});
Expected behavior
The output table ought to return "12:00 PM" for all cases.
Actual behavior
The "13th 2xUTC offset" value produces "11:00 AM" during DST.
Information
Day.js Version v1.10.5
OS: Windows
Browser: Chrome, Node
Time zone: All
The text was updated successfully, but these errors were encountered:
Describe the bug
Assigning the same
utcOffset
multiple times causes the formatted time to shift when the time is across a Daylight Savings Time boundary.The following code demonstrates the issue:
Expected behavior
The output table ought to return
"12:00 PM"
for all cases.Actual behavior
The
"13th 2xUTC offset"
value produces"11:00 AM"
during DST.Information
The text was updated successfully, but these errors were encountered: