-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
dayjs.add() behaves incorrect with timezones #2624
Comments
HI @helmut-jacob , I'm trying to reproduce the issue but the test is passed on my side. |
Thanks @klm-lab for trying! Could this issue depend on the environment (browser, Node?) ... I've noticed the issue in application code and worked around it by converting to UTC before adding. The code above was the smallest reproducer I could come up with (for now) which fails in my environment. |
@helmut-jacob Maybe this issue depend on the environment. |
Having the same problem here :( I'm working with recurrences so using local time is important, and it messes up in daylight savings. Here's some code to illustrate:
These print out the following:
The first two print statements are correct, which 5am is expected when adding 1 week in local time, changing EST to EDT. (Daylight savings occur on March 8 in 2020) However, the last two statements are incorrect. 5:00am EDT should convert to 9:00am GMT, not 10:00am. The toISOString() for the EDT time also prints out incorrectly, where the EDT offset is -4, not -5. But, when add is not used (eg. manually setting the times). It works as expected.
Appreciate any pointers if anyone is facing the same problem. |
Describe the bug
Adding a delta to timezone-aware dayjs objects results in a different result compared to adding to utc dayjs object.
Can be reproduced with the following piece of code:
Expected behavior
add() should properly work with timezone-aware dayjs objects.
Information
The text was updated successfully, but these errors were encountered: