Live data from Hacker News

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

news.ycombinator.com

91–100 of 498 posts

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

#93

Earlier quoted context omitted.

Odd, mine is showing the right date.

Are you sure? My F91W doesn't even ask for year in settings. How would have it known it is a leap year or not. Some other models (not F91W) does track year.

I was responding to the claim about the Samsung Watch not showing the right date, I unfortunately have never owned the older kinds of "smartwatches" :)

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

#94

Our ETL process is heavily monitored so we never miss a days data, but we got a surprising error "cant build aggregates - missing data, aborting MV refresh, data will be a day old". It was the year to date (YTD) calculation - no data for 29/2/2023 to compare to today.

This is why -365 days can be better than -1y.

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

#95
post #18

Earlier 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?

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?

#96
post #8

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

I'll take a February 30 if it means every other month is 30 days too, and we just get the extra days as universal, extended winter holiday where no one can legally be required to work because there is no December 31st or January minus-fourth.

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

#97
post #24
post #11

The Casio F-91W doesn’t account for the year, it showed today’s date as Thursday, March 1st.

Same with my colleagues most recent top model Samsung Galaxy Watch :]

Are they using a third party watch face? My Galaxy Watch 4 has no issues.

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

#98
post #28
post #8

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

Let's just be happy that it isn't still the day after February 24 that becomes the inserted leap day. https://www.isof.se/lar-dig-mer/kunskapsbanker/lar-dig-mer-o...

We should just do what we do for time changes and do feb 28 over again.

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

#100
post #83
post #36

Python. cls = , data_string = 'Feb 29 04:55:03.687' format = '%b %d %H:%M:%S.%f' E ValueError: day is out of range for month

As mentioned by sibling comments, it's because you're not specifying a year. If you change the day to the 28th you'll see that it defaults to the year 1900: >>> datetime.strptime('Feb 28 04:55:03.687', '%b %d %H:%M:%S.%f') datetime.datetime(1900, 2, 28, 4, 55, 3, 687000) >>> datetime.strptime('Feb 28 13:37:06.942', '%b %d %H:%M:%S.%f') datetime.datetime(1900, 2, 28, 13, 37, 6, 942000)

That makes it weird though, because 1900 was a leap year? I sort of get it, but it's a slightly odd and inconsistent decision.

Edit: no it's not, it's absolutely correct, leap years just aren't as simple as I thought!

Post reply on HN