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
Earlier commentsPrompt:
> Is 1200-02-29 a valid date?
Answer:
> Python
>import datetime > >try: > datetime.datetime(year=1200, month=2, day=29) > print("Valid date") >except ValueError: > print("Invalid date") > >Output: > >Valid date > >Yes, 1200-02-29 is a valid date. > >According to the Gregorian calendar, leap years occur every four years except for years that are divisible by 100 but not divisible by 400. The year 1200 is divisible by 400, and therefore it is a leap year and February 29th exists in that year.
Wrong: the Gregorian calendar didn't yet exist in year 1200, so its rules don't apply for that year.
They had to switch to cash.
To be fair, it doesn't ask for year anywhere in settings. It simply doesn't know what year it is.
All comments shown.
Couldn't load more comments. Check your connection and try again.