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
When creating a dayjs object and changing its timezone to any zone with 0 offset (UTC, in this example, for simplicity), then calling .tz("UTC", true) on the same object, it appears as if it has some kind of mutation.
Using isSame to compare the object with a copy of itself that was declared before calling .tz("UTC", true) returns false, although in the console both objects seem to have equal values.
As stated, this happens with all zones with 0 offset, so, for instance, replacing 'UTC' with 'Africa/Abidjan' in the code yields the same result.
In general, everything utc related seems to be kinda weird right now, as there are some other shenanigans that I have encountered in our actual project but can't find a way to properly reproduce them in an isolated environment.
Expected behavior isSame should return true due to immutability.
Information
Day.js Version: v1.11.13
OS: macOS Monterey 12.5
Browser: Chrome 127
Time zone: GMT-06:00, also happens when using the browser's console to emulate a timezone with a positive offset, such as GMT+01:00.
The text was updated successfully, but these errors were encountered:
Describe the bug
When creating a dayjs object and changing its timezone to any zone with 0 offset (UTC, in this example, for simplicity), then calling
.tz("UTC", true)
on the same object, it appears as if it has some kind of mutation.Using
isSame
to compare the object with a copy of itself that was declared before calling.tz("UTC", true)
returnsfalse
, although in the console both objects seem to have equal values.Reproduction on Codesandbox
As stated, this happens with all zones with 0 offset, so, for instance, replacing 'UTC' with 'Africa/Abidjan' in the code yields the same result.
In general, everything utc related seems to be kinda weird right now, as there are some other shenanigans that I have encountered in our actual project but can't find a way to properly reproduce them in an isolated environment.
Expected behavior
isSame
should returntrue
due to immutability.Information
The text was updated successfully, but these errors were encountered: