Live data from Hacker News

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

news.ycombinator.com

441–450 of 498 posts

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

#441

Earlier quoted context omitted.

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

> No, 2024 is not a leap year. Leap years are years divisible by 4, except for years that are divisible by 100 unless they are also divisible by 400. Therefore, the next leap year will be 2024.

Apparently it reads 2024 as two different numbers: 202 and 4

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

#443
Yeah, I have a Python script for personal use, and briefly could not figure out why it was crashing. The reason : I was using

class datetime.date(year, month, day)

which was attempting to generate "today, one year ago" by reusing the current month and day, but replacing the year with year-1.

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

#444
post #268

Earlier quoted context omitted.

Is March more logical? Feb 29 + 1 year = Feb 28.

You're begging the question. [1] "Feb 29 + 1 year" is verbatim restatement. --- You can say Feb 29 + 365 days = Feb 28. (And Feb 29 + 730 days = Feb 27.) --- EDIT: Note that in the context of birthdays, people use "calendar years," not "unit of time which is ~1 revolution around the sun." Birthdays aren't celebrated every X million seconds after the moment of birth. They are celebrated the same day each calendar year…

> Birthdays aren't celebrated every X million seconds after the moment of birth.

As a surprise for a friend of mine, I threw him a gigasecond party on the day he turned 1000 million seconds old. Yes he was surprised, and a good time was had by all.

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

#445

Earlier quoted context omitted.

365.2421 is more correct. Nasa explains: 365 +0.25 - 0.01 + 0.0025 - 0.00025 = 365.24225 https://pumas.nasa.gov/examples/how-many-days-are-year

>Omitting a leap year every 4000 years Wait, is this right? omitting every 100 and adding every 400 should be enough. EDIT: the 4000-year rule is just a proposal for now. So 365.2425 is correct.

None of us will live long enough to see the 4000-year rule become a problem. I don't even expect to be around for the next 100-year rule.

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

#446

Earlier quoted context omitted.

This has been a factor in contract law for longer than computers have existed. "Subtract a year" or "Add a year" aren't really imprecise, it's just that there are two ways you can interpret it: 365 days, or 12 months. When adding, you get the same result: end of February, the 28th. Subtracting, you get one of March 1st for 365 days and February 28th for 12 months. Most jurisdictions use the 12 month standard, fwiw. I…

Which type of year? Sidereal or solar? Did you account for axial precession?

To be a bit blunt, these questions are entirely irrelevant, since you know the answer as well as I do: the calendar year, the one Western law and international business uses uniformly. It's very clever of you to mention that other concepts of the year exist. Kind of. Would have been more clever if you'd realized that they aren't germane, any more than the Islamic, Jewish, Indian, or Chinese years are.

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

#447

Many years ago I visited Laos. We crossed the border at a rather remote and little-used border crossing. Laos issues 30-day tourist visas on arrival. We arrived on February first and I have a Laotian visa valid until February 30th, 2011. Not a leap year bug but a February bug. Ended up being inconsequential, but still makes for a fun story.

You have a picture?

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

#448
post #268

Earlier quoted context omitted.

Is March more logical? Feb 29 + 1 year = Feb 28.

Feb 28 is definitely too early, you haven't lived a whole year yet since your birthday. So March 1 it is. It's not your birthday but you can celebrate having made it another year.

Well 'year' can mean two different things though: 'calendar year' or 'solar year'.

Your calendar year birthday would be March 1 since one full calendar year has elapsed.

But Feb 28 is the nearest day to one full solar year, assuming you were born before about 6pm local time on Feb 29.

Two-day long birthday it is! :)

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

#449
post #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. :)

LOL, a good example of correlation does not equal causation.

It's not. There was no correlation at hand here - this was just a coincidence

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

#450
post #449

Earlier quoted context omitted.

LOL, a good example of correlation does not equal causation.

It's not. There was no correlation at hand here - this was just a coincidence

I would think it's an edge case of correlation, but still correlation (100% of the time it has had this error, it was on a leap day, 0% of the time it was not)
Post reply on HN