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 commentssorry, this has nothing to do with you, just a pet peeve.
Compare that to something more mathematically rigorous: "Today is warmer than 98.72% of days between February 25th and March 5th". Nobody's going to click that link.
but the idea seems like it's agreeing.
Though you're correct in that year-over-year weather changes and daily maxima lack the significance of long-term climate trends.
https://news.ycombinator.com/item?id=4128208
My brain just doesn't get the concept I guess, I always struggle a lot whenever I need to touch anything that does anything with dates/time
https://www.cloudflarestatus.com/
Old code:
expires = datetime.datetime.now(tz)
expires = expires.replace(year=expires.year + 1)
It broke yesterday, throws an exception ("ValueError: day is out of range for month"). It's kinda obvious that it does.
Fixed version code:
expires = datetime.datetime.now(tz) + datetime.timedelta(days=365)
expires = expires.isoformat(timespec="seconds")
Now we're just going 365 days into the future. Of course, this has a slightly different meaning and outcome, we are not always ending up on the "same date next year". But in this use case it doesn't really matter.
All comments shown.
Couldn't load more comments. Check your connection and try again.