-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DateTime.add(Duration days) produces wrong date #37449
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
Comments
This is working as intended. It is definitely related to daylight saving. A When you add 7 * 86400 seconds to a local time If you make your |
Thanks! |
I am also facing the same even by adding seconds instead of days. |
/*
Bug description: Adding duration of Days to DateTime is consistently WRONG in certain months.
DateTime mysteriously adds 23 hours (in month 11, Nov) in addition to the days
resulting in WRONG date and of course day of week. In a loop it continues with this error
until mysteriously correcting itself a few months later.
In the following test, I'm adding 7 days in the loop and also printing the weekday so that you can
spot the problem easily. Also of course keep an eye on the hours in the dates printed.
Printing several years to prove bug consistency every year, at same month.
[Update: Possibly related to switching back from DST]
*/
The text was updated successfully, but these errors were encountered: