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

Incorrect UTC offset when manipulating dayJS object (DST/STD change) #1622

Open
georgehrke opened this issue Sep 2, 2021 · 0 comments
Open

Comments

@georgehrke
Copy link

Describe the bug
In the code-snipped below, a new dayjs object is initialized and set to Asia/Tel_Aviv. This timezone is different from my own one, which is Europe/Berlin.

The object is set to the 31st of October 2021. On that day, Israel (and the majority of the remaining world, which is observing DST) will change back from Daylight Savings Time to Standard Time.

2 am correctly appears twice. However, the UTC offset incorrectly does not change. Instead of printing 02:00+03:00 twice, it should print 02:00+03:00 once, followed by 02:00+02:00

let day = dayjs('2021-10-31').tz('Asia/Tel_Aviv').startOf('day');
console.log(day.format('HH:mmZ'));
day = day.add(1, 'hour');
console.log(day.format('HH:mmZ'));
day = day.add(1, 'hour');
console.log(day.format('HH:mmZ'));
day = day.add(1, 'hour');
console.log(day.format('HH:mmZ'));
day = day.add(1, 'hour');
console.log(day.format('HH:mmZ'));

Expected behavior

Actual Expected
00:00+03:00 00:00+03:00
01:00+03:00 01:00+03:00
02:00+03:00 02:00+03:00
02:00+03:00 02:00+02:00
03:00+03:00 03:00+02:00

Information

  • Day.js v1.10.6
  • OS: macOS Big Sur (11.5.2)
  • Browser: Google Chrome 92.0.4515.159 (Official Build) (x86_64)
  • Time zone: Europe/Berlin (we are currently on UTC+02:00)
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

1 participant