Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+00:00 timezone bug #1675

Open
janousek opened this issue Oct 25, 2021 · 1 comment
Open

+00:00 timezone bug #1675

janousek opened this issue Oct 25, 2021 · 1 comment

Comments

@janousek
Copy link

janousek commented Oct 25, 2021

This line is causing several bugs when working with +00:00 timezones (for example Europe/Lisbon):

? this.$offset + (this.$x.$localOffset || (new Date()).getTimezoneOffset()) : 0

It is because $localOffset is 0 (this is correct offset) and therefore value of (new Date()).getTimezoneOffset() is used (instead of the value 0).
Operator || cannot be used here, because it does not work correctly with $localOffset == 0.
This line should be changed into:

? this.$offset + (this.$x.$localOffset === null || this.$x.$localOffset === undefined ? (new Date()).getTimezoneOffset()) : 0
@DimaBur
Copy link

DimaBur commented Oct 31, 2021

Have the same problem, created PR with fix #1678

janousek added a commit to janousek/dayjs that referenced this issue Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants