One cleanup script broke because Python doesn’t have a clean way to subtract a year, and if you do now.replace(year=now.year-1), you get a ValueError when now is 2/29. It’s easy enough to address. There are various StackOverflow posts on such things. Here is one: https://stackoverflow.com/questions/54394327/using-datetime-...
Ask HN: Did you encounter any leap year bugs today?
71–80 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#72Earlier quoted context omitted.
That's generally risky to do nowadays because of things like TLS certificate expiration.
In a few hours you'll be able to backdate to "yesterday", with very low chances of hitting cert expiry issues (but I wouldn't be surprised if OP's issue involves components outside of their control or ability to test end-to-end)
Re: Ask HN: Did you encounter any leap year bugs today?
#73We got a bunch of close-dated yogurt the other day. Several were best by 2-27, 2-28, 3-01, and 3-02, but none by 2-29.
traditionally known as the "Angel's Share" :P
Re: Ask HN: Did you encounter any leap year bugs today?
#74It takes 130 years from the current date and uses that in an SQL statement to compares it to the date of birth. DB2 doesn't like 1894-02-29.
Apparently it happens every 4 years, but no-one can be bothered to fix it.
Re: Ask HN: Did you encounter any leap year bugs today?
#75Re: Ask HN: Did you encounter any leap year bugs today?
#76Heard from a friend in China: the age calculation portion of the app to schedule a marriage certificate had a bug where they subtracted 22 (legal minimum age) from the year, which resulted in 2002-02-29 which doesn't exist. The app intends to compare this against the user's birth date. The error handling code assumes all errors are from the comparison. The app then rejected all marriage certificate appointments by co…
Re: Ask HN: Did you encounter any leap year bugs today?
#77Payroll software at work had a one-off planned maintenance day today, presumably to avoid worrying about any bugs.
Re: Ask HN: Did you encounter any leap year bugs today?
#78Earlier quoted context omitted.
What is your definition of "subtracting a year"? Seems like that's a relatively ambiguous operation without more specification.
Can you think of any situation where subtracting a year from today's date is ambiguous when today isn't, well, today?
Re: Ask HN: Did you encounter any leap year bugs today?
#79I can understand getting the years 2000 (leap), 2100 (not leap), 2200 (not leap), and 2300 (not leap) wrong. But getting the year 2024 wrong is, disappointing, to put it diplomatically.