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
the issue is it creates new Date object and retrieves the browser timezone offset from that, but if the user is in DST and the date that's being casted to timestamp is not (or vice-versa), the result is incorrect.
there is a pull request to fix this #1448 and there is a plugin in the pulls conversation to fix this while we wait.
but since it's a year old and not merged (even though it's a big problem), one has to wonder where to focus of this project is.
Describe the bug
The
utc.valueOf
method doesn't correctly account for DST when$x.$localOffset
is not set:dayjs/src/plugin/utc/index.js
Lines 116 to 117 in 4a7b7d0
the issue is it creates new
Date
object and retrieves the browser timezone offset from that, but if the user is in DST and the date that's being casted to timestamp is not (or vice-versa), the result is incorrect.Minimal repro:
Expected behavior
The browser timezone offset should be calculated from the date itself, not new instance. Something like this:
Information
The text was updated successfully, but these errors were encountered: