Live data from Hacker News

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

news.ycombinator.com

211–220 of 498 posts

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

#211
post #118

Earlier quoted context omitted.

For the survalence records Telling base where, and when, you were

Shouldn't that just be a unix timestamp or something? You'd think resolving that to a date time could be done in the UI instead of in the business logic

"should"

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

#212
post #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.

> There's a clean way to subtract 365 days

What is it? Does it attempt to return a datetime that's the same time as the input but 365 calendar days earlier (ignoring leap seconds? compensating for time zone changes?), or does it subtract 31536000 seconds from the current datetime? Because those aren't necessarily the same and it's ambiguous which one you mean by "subtract 365 days"

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

#214
Last night around 8:00 PM I noticed the time on my Linux laptop was wrong. I tried to reset it manually and got a "Cannot set current time" error. Closed the dialog and a minute or two later the time reset to the correct value. I shrugged it off as something random.

Then today I get home from work, un-suspend that same laptop and the time and date are both wrong now. It has it as around 10pm last night. Turn off auto updates and turn that back on, and nothing happens. Wait 4 or 5 minutes, nothing happens. So I finally decided to reboot, which does indeed clear things up. Only then did I remember that today is Feb 29th and make the connection that this might be related to the leap year.

Can't say for 100% certain that it was, but it would be one hell of a coincidence otherwise.

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

#215
post #103

We have a product that uses ChatGPT via the API, using the 3.5 turbo version. Our query involves some dates. Instead of giving back text like it usually does, today it has been giving errors because it does not think 2024-02-29 is a valid date. This is easy to reproduce with the web interface, at least sometimes [0]. It start out by saying it's not a valid date and then as it's explaining why it isn't it realizes its…

ChatGPT thinks today is March 1. Go ahead and ask it what today’s date is.

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

#216
post #103

We have a product that uses ChatGPT via the API, using the 3.5 turbo version. Our query involves some dates. Instead of giving back text like it usually does, today it has been giving errors because it does not think 2024-02-29 is a valid date. This is easy to reproduce with the web interface, at least sometimes [0]. It start out by saying it's not a valid date and then as it's explaining why it isn't it realizes its…

ChatGPT thinks today is March 1. Go ahead and ask it what today’s date is.

It is March 1 in many places

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

#217
post #207

Earlier quoted context omitted.

Wired: LLM are practically AGI Tired: ChatGPT thinks February 29th isn't a valid date.

My favorite prompt: asking "How many e's are there in the word egregious". Always says three (ChatGPT 3.5, 4, 4 turbo). When you ask it which three, it realizes its mistake and apologizes (or sometimes tells you where they are that is completely wrong). Looks like it just outputs gibberish for these things.

It’s always gibberish, it’s just really good at guessing.

I forgot what exactly it was I was doing. We were trying to get it to generate word lists of words ending with x or maybe it was starting with. For a marketing PoC and it made up oceans of words that not only didn’t start/end with x but mostly didn’t include x at all.

Isn’t this also why it can pass CS exams and job interviews better than like 95% of us, but then can’t help you solve the most simple business process in the world. Because nobody has asked that question two billion times on its training data.

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

#220

I wear Xiaomi's Amazfit Pro 3R. Digital. Wrist band. Hung at midnight of 29th Feb today. Did a bunch of factory reset but didn't recover. And then recovered at the morning of 1st of March. Date is relatively simple. days_in_month(year, month) : if(month==2) return days_in_feb(year) //all other months have constant number of days, always. days_in_feb(year,month) : if(!(year % 400)) return 29; if(!(year % 100)) return…

your function returns 29 days for every year not divisible by 400
Post reply on HN