Ask HN: Did you encounter any leap year bugs today?
524 pointsAfter a frantic scramble this morning, our billing team has finished patching a bug which erroneously was charging our monthly subscribers for an extra day.
All test suites are passing now, and SRE has scheduled a postmortem after the QA confirms the fix in 2028.
Comments (481) 159 threads
Show all comments
Showing thread 31 of 159
The confusing part, to me, is that Python would consider the above string to be parsed into a date in the first place, given that it has no year.
datetime.strptime('Feb 29 13:37:06.942', '%b %d %H:%M:%S.%f')
edit: added code example. import datetime from datetime first obvi
Edit: no it's not, it's absolutely correct, leap years just aren't as simple as I thought!
Continue this thread — 1 reply
> However, there is still a small error that must be accounted for. To eliminate this error, the Gregorian calendar stipulates that a year that is evenly divisible by 100 (for example, 1900) is a leap year only if it is also evenly divisible by 400.
> For this reason, the following years are not leap years:
> 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600
I had no idea!