Live data from Hacker News

Ask HN: Did you encounter any leap year bugs today?

news.ycombinator.com

31–40 of 498 posts

Re: Ask HN: Did you encounter any leap year bugs today?

#31
post #18
post #4

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-...

What is your definition of "subtracting a year"? Seems like that's a relatively ambiguous operation without more specification.

Since they mentioned a clean up script, I assume they could easily just use 365 days for that use case.

Re: Ask HN: Did you encounter any leap year bugs today?

#32
post #18
post #4

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-...

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?

#33
No, but some of our software writes data to rotating directories named after the date, and while doing some manual debugging on a test system, it started failing to create these directories the first time it rotated on Feb 29 UTC. Turns out it just happened to run out of disk space at that time, but I had myself convinced that it was a leap year bug for over an hour. :)

Re: Ask HN: Did you encounter any leap year bugs today?

#34
post #4

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-...

It's not that python doesn't have a clean way to subtract a year, it's that "subtract a year" is imprecise. There's a clean way to subtract 365 days, and there's a clean way to set the year one year earlier. But if you're doing the second thing, is python supposed to silently change to March 1 when you change the year from a leap day? There's no way around handling edge cases.

Re: Ask HN: Did you encounter any leap year bugs today?

#35
post #4

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-...

Okay I am having really odd undefined behavior in Python in UART communications that were working just fine yesterday... My boss joked it could be a leap year thing but at this point it wouldn't surprise me. Switch over to using Rust and no issues at all

Re: Ask HN: Did you encounter any leap year bugs today?

#37
My Casio F91W I assumed would know that year YYYY is leap, and would show 29th as Date. No, it showed 1 as in March (it doesn't show months). I had to manually set it back to 28th so that tomorrow it shows correct date.

To be fair, it doesn't ask for year anywhere in settings. It simply doesn't know what year it is.

Re: Ask HN: Did you encounter any leap year bugs today?

#38
post #8

Just hope the King of Sweden doesn't make another February 30. https://www.timeanddate.com/date/february-30.html

Every time I go to timeanddate.com I feel like I see a link to the Leap Day page (https://www.timeanddate.com/date/leap-day.html) that shows the meme-infamous boyfriend-checking-out-another-girl couple, except she's proposing to him! Obviously this happened earlier that day since they're wearing the same outfits, and I can't help but feel bad for her knowing what's coming but unable to warn of the impending train wreck.

Re: Ask HN: Did you encounter any leap year bugs today?

#40
This one is rather specific, but a game rhythm based Final Fantasy game called Theatrhythm Final Bar Line is simply not allowing people to play today because it has an internal system that awards prizes for specific days and they didn't handle the case of what to do when it's on a leap day. You can boot it up but can't actually play the game as a result.

Not working on the game or anything but found it moderately amusing as someone who owns the game!

Post reply on HN