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

using utcOffset setter with keepLocalTime = true results in inconsistent date #1412

Open
icguy opened this issue Mar 10, 2021 · 1 comment
Open

Comments

@icguy
Copy link

icguy commented Mar 10, 2021

Describe the bug
if .utcOffset setter is called with the second param (keepLocalTime) set to true weird things start to happen:

  • the toString() function will return incorrect results.
  • diff() function will work incorrectly
  • the format() function however returns the correct result

Reproduction on dayjs website in chrome js console:

image

Expected behavior
The format and toString functions should return consistent results, being the same date, diff should return zero.

Information

  • OS: Windows
  • Browser Chrome 88.0.4324.190
  • Time zone: CET
@CoreyKovalik
Copy link

Hey @icguy 👋

I ran into this at my company, where we have one app using luxon and one using dayjs. seems that luxon does not make this error. I noticed you posted this on Mar 10, which is close to DST in spring. DST is a week away now for fall on the 7th. 😅 ....

I wonder how many people are running into bugs like these around DST every year!

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

No branches or pull requests

2 participants