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

.add() does not take the given time zone and uses local system time zone resulting in incorrect date times during daylight savings #2821

Open
hannahbrown97 opened this issue Jan 29, 2025 · 0 comments

Comments

@hannahbrown97
Copy link

Describe the bug
In UTC the datetime string 2025-03-08T15:30:00+00:00 converted to time zone Australian/Adelanie 2025-03-09T03:00:00+10:30. which is wrong, it should be 02:00. The dayjs object has raw data using my local system time CST, the time zone and offset are set to Australian/Adelanie but since my local time is observing DST , it incorrectly converts.

This occurred when trying to create a list of times and adding a given interval
dayjsObj.add(15, 'minute')
it would be correct in UTC but if the dayjsObj was given another time zone while my local system was CST it would go from 2025-03-09T01:45:00+10:30 to 2025-03-09T03:00:00+10:30 which is incorrect

Expected behavior
when adding toa dayjs oobject with dayjsObj.add(15, 'minute') given the time zone +10:30 it should go from 2025-03-09T01:45:00+10:30 to 2025-03-09T02:00:00+10:30

Information

  • Day.js Version [e.g. v1.0.0]
  • OS: [e.g. iOS]
  • Browser [e.g. chrome 62]
  • Time zone: [e.g. GMT-06:00 DST (CST)]
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