Heard 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…
Ask HN: Did you encounter any leap year bugs today?
61–70 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#62One 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-...
Re: Ask HN: Did you encounter any leap year bugs today?
#63Re: Ask HN: Did you encounter any leap year bugs today?
#64Several were best by 2-27, 2-28, 3-01, and 3-02, but none by 2-29.
Re: Ask HN: Did you encounter any leap year bugs today?
#65’’’ + if time.Now().Month() == time.February && time.Now().Day() == 29 { + t.SkipNow() + } ’’’
Fixed.
Re: Ask HN: Did you encounter any leap year bugs today?
#66Re: Ask HN: Did you encounter any leap year bugs today?
#67Re: Ask HN: Did you encounter any leap year bugs today?
#68The Casio F-91W doesn’t account for the year, it showed today’s date as Thursday, March 1st.
Re: Ask HN: Did you encounter any leap year bugs today?
#69Why are there so many stories about leap year bugs?
Re: Ask HN: Did you encounter any leap year bugs today?
#70Earlier 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?