-
Notifications
You must be signed in to change notification settings - Fork 9
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
Off-by-one in precise_sub #13
Comments
This seems to have something to do with leap years (the library incorrectly thinks that 2026 is leap). If we don't cross the boundaries of 2026-02-28, we get correct results:
But if we try with 2026-02-29 (should not even allow us to do it), we get this:
So it seems that |
I was wrong, doesn't have anything to do with leap years:
For this case it only happens for dates between 2025-07-10 and 2025-07-30:
Seems to happen when jumping from the last day of an odd numbered month into July but not for all days of July:
So far I haven't been able to reproduce it with anything other than July The smallest reproducible seems to be:
|
Originally reported here by Stephen Dolan
I expected that if I use CalendarLib.Calendar.Precise.precise_sub to compute the difference between two dates, then I could add this difference to the earlier and get the later.
However, if I attempt this on [2025-03-31 17:53:04; 2026-07-19 12:15:23], then the result of add is 2026-07-20 12:15:23, not 2026-07-19 12:15:23.
The text was updated successfully, but these errors were encountered: