Why are there so many stories about leap year bugs?
It’s strange to me, it hasn’t been than long since a leap year and I don’t remember as many last time.
Ask HN: Did you encounter any leap year bugs today?
121–130 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#122The other way around! Today a few services that don't congratulate me on my birthday (on non-leap years) did. I was born on February 29th.
Re: Ask HN: Did you encounter any leap year bugs today?
#123Earlier quoted context omitted.
But then it'll be off by one day for the rest of this year. And someone will notice that they no longer have March 1 2023-March 1 2024 in their chart, but March 2 2023
It's a cleanup script. I bet nobody cares it's off by one day. Also I doubt a cleanup script has a charting function. Everything is use case dependent. Sometimes the use case is unimportant enough that mistakes are okay.
There's often someone out there who interprets such things as a 3 month, or 1 year retention policy and that it means they're entitled to look at the entire range whenever they want.
Re: Ask HN: Did you encounter any leap year bugs today?
#124Earlier quoted context omitted.
Can you think of any situation where subtracting a year from today's date is ambiguous when today isn't, well, today?
Moving bank/festive holidays, first Monday of the year(, first work day of the year not Monday if that's NYD and bank holiday), lunar occasions. 'subtract a year' is imprecise and has many meanings, if what you want is 'same day, same month, previous year' then say that and do that, that's conceptually `date.year -= 1` not `date -= 1 year`, and will have this bug.
Re: Ask HN: Did you encounter any leap year bugs today?
#125Yes - I triple-checked the calendar to verify my suspicion this February might have 29 days. The result was always negative - it seemed 28. Then February the 29th actually came. A bug apparently occurred in my mind.
Re: Ask HN: Did you encounter any leap year bugs today?
#126Re: Ask HN: Did you encounter any leap year bugs today?
#127The other way around! Today a few services that don't congratulate me on my birthday (on non-leap years) did. I was born on February 29th.
How often do you encounter challenges related to your birthday? Meaning, not just on the day of Feb 29, but any day of the year when you're trying to select your birth date or something like that. Do you ever find forms where the date is missing or the backend wont accept it?
Whenever February 29 wasn’t present as an option, the frontend was at fault, so I could set the right value in the inspector as a workaround.
Other times February 29 was present as an option, only to be saved as February 28. Never March 1, which I’d say would be more coherent.
Re: Ask HN: Did you encounter any leap year bugs today?
#128The other way around! Today a few services that don't congratulate me on my birthday (on non-leap years) did. I was born on February 29th.
Re: Ask HN: Did you encounter any leap year bugs today?
#129All street lamps in Paris turned off at midnight :) https://www.leparisien.fr/paris-75/paris-pourquoi-les-rues-d...
Re: Ask HN: Did you encounter any leap year bugs today?
#130I certainly did. There is a batch process to cull old records. It checks for customers who do not have a date of death recorded but are > 130 years old, as it assumes that we weren't informed of their death. It 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…
A simple fix would be to change it to a multiple of 4 (e.g. 124 years). Then it would fail every 100 years.