Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Did you encounter any leap year bugs today?
524 points by sjr1 74 days ago | hide | past | favorite | 481 comments
After a frantic scramble this morning, our billing team has finished patching a bug which erroneously was charging our monthly subscribers for an extra day.

All test suites are passing now, and SRE has scheduled a postmortem after the QA confirms the fix in 2028.




Heard from a friend in China: the age calculation portion of the app to schedule a marriage certificate had a bug where they subtracted 22 (legal minimum age) from the year, which resulted in 2002-02-29 which doesn't exist. The app intends to compare this against the user's birth date. The error handling code assumes all errors are from the comparison. The app then rejected all marriage certificate appointments by complaining that the users are too young to marry legally.


Haha, that would be quite the appropriate place to put one of those "Please wait and try again" error messages.


"look, today the math just doesn't work out, try tomorrow"


This is often the result of consulting an astrologer in Asia for a marriage date, to be fair.


Maybe some people trying to get away with buying anniversary gifts every 4 years


How do leap day birthdays get handled in general? How is the right age iterated every year?


Relevant question for driving, voting, marrying, drinking. I'd assume just the date is compared.

If you are born on 29th, on future 28th you are considered "too young", regardless whether a 29th exists or not. On future March 1st you are "old enough" again regardless.

If a 29th exists you are old enough already on that date. Drinking beer in Germany at 16, I guess in some countries at 20 could be relevant cases. For the more common minimum age of 18 for many things, the limit is reached always on March, 1st because a 29th cannot exist.


Both Feb 28 and Mar 1 are commonly used to celebrate birthdays.

AFAIK there is no firm convention. Feb is more natural ("My birthday is in February"), Mar is more logical (the 60th days of the year).


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 -- notwithstanding the fuzzy concept of "same day" for incongruent calendar years. There's no singuar right answer, but that is the core question: "what is the same day next (calendar) year?"

[1] https://en.wikipedia.org/wiki/Begging_the_question


> Feb 29 + 365 days = Feb 28.

Correct.

> And Feb 29 + 730 days = Feb 27

Incorrect. It's Feb 28 again. In a normal, non-leap year, if you add 365 days then you get back to the same date.


Sorry, typo I meant that Feb 28 + 730 days = Feb 27 (sometimes)


> what is the same day next (calendar) year?"

When I wrote "+ 1 year" I meant year to represent 365 or 365.25 days, not "the same day next year.":

  >>> from datetime import date, timedelta
  >>> year = timedelta(days=365.25)
  >>> date(2024, 2, 29) + year
  datetime.date(2025, 2, 28)
You may have interpreted it as begging the question, but it was not my intent—though I admit my formulation was ambiguous.

> Note that in the context of birthdays, people use "calendar years," not "unit of time which is ~1 revolution around the sun."

You've never heard someone say they've celebrated another trip around the Sun? I literally have a photo from 2007 of my daughter in Montessori celebrating her birthday by holding a globe and walking around a candle representing the Sun. I think most people probably don't really think about whether it's a calendar year or astronomical year because for most people, they are usually equivalent and it doesn't matter.

But that's all beside the point. All I meant to point out is that I disagree that March is more logical. I don't think logic points us to one month or the other. You may feel March is more logical, but I don't accept your priors, so for me March is not more logical than February.


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


Many people say: Happy turn around the sun! and 365 is not the length of a year is the length of some years so, who knows... I'm against time zones and pro 28 days months and a couple of free days :D


By this logic, all birthdays would slowly drift as leap years pass.


Take DOB + n * 365.25 and then pick whatever day that falls in? That way it shouldn’t drift overall. Though, I guess it would imply that what day of the year people celebrate on, would be off by one day on leap years compared to what it is on other years?


This formula doesn't consider how we sometimes skip leap years, and sometimes have leap seconds, so it's vastly imprecise.


So make it more precise. DOB + n * 365.2421.


365.2425


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.


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! :)


Think of it this way: if Feb 29 didn't exist that year, it would have been March 1.

If we're being scientific I guess all of us should move our birthday up by 1 day on leap years, but that seems annoying and not sure anyone really cares enough to.


No we should move our birthday celebration up by 6 hours every year. But that would be only relevant if we were celebrating at the exact hour of our birth.


We already don't move them for timezones. I was born at 3am but in France, when I'm in the US I don't celebrate the day before.


I asked JavaScript:

    const { format } = Intl.DateTimeFormat("en-UK", { month: "short", day: "numeric" });

    const date = new Date(2024, 1, 29);
    console.log(format(date));
    // 29 Feb

    date.setYear(2025);
    console.log(format(date));
    // 1 Mar

    const year = 1000 * 60 * 60 * 24 * 365.2425;
    console.log(format(new Date(2024, 1, 29).getTime() + year));
    // 28 Feb
I guess both are logical by some definition of logic.


I can agree with that.


Similar to the recent standup maths video where the town did it's art installation incorrectly - the fence post problem / off by one.

https://youtu.be/FAdmpAZTH_M?si=r_INH_C5j9mbpJSh


What’s the significance of 365? Each Earth year has just a smidge under 365.25 days.


365 days is what people commonly think of as a year. So if you're born Feb 29th and celebrate your birthday one year later (whether you call that 365 or 365.25), you land on Feb 28th. Then again, folks born between Jan 1 and Feb 28th of a leap year celebrate their birthdays 366 days later by calendar days.

Anyway, I'm not sure there's any more or less logical date to use and Feb 29th babies seem to choose both about equally:

> “I love when people ask me, ‘Do you celebrate on Feb. 28 or March 1?’” said Raenell Dawn, a co-founder of Honor Society of Leap Year Day Babies. “I get to tell them, ‘Both, because I can.’ But I’m a February baby; I was not born in March.” An informal poll of the society’s members showed about a 50-50 split between the two dates, said Ms. Dawn, who is celebrating her “Sweeter 16” by turning 64 this year.

https://www.nytimes.com/2024/02/28/style/leap-year-explained...


Celebrating on the 28th makes no sense. That is when you celebrate your Birthday Eve every year so your birthday is the next day, whatever that is.


You can make the same argument that March 1st makes no sense, as that is the day of your birthday hangover, the day after whenever your birthday is.


But 1 day is still 24 hours.

If you want to celebrate your birthday at the moment earth reaches the same spot around the sun as when you were born, then we’d all have the same issue - we’d have to celebrate it 6 hours later every year, reseting every 4 years.

February 29 is very much a new day… which simply doesn’t exist on non-leap years.


Sadly, I can say from experience the American draft does not count the number of birthdays celebrated to figure out if you're eligible to serve.


You got drafted when you were five?


More like 4… since you can go to vietnam at 17. You're thinking of the age to drink a beer.


Can't get drafted at 17. I don't know if you can go or not.


Raffaele Minichiello volunteered at 17.

https://it.wikipedia.org/wiki/Raffaele_Minichiello


Volunteering is the opposite of getting drafted


The most common approach I’ve seen is to alias them to Mar 1st.


so … many bullets were dodged today


Opinionated devs are the best devs.

Tell us about your last marriage?, lol


It's a leap year miracle!


This is why you use a datetime library.


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


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)


It might appear as a correlation due to sampling error, but the two variables have no dependence with each other. There is no correlation with it being February 29 and the bug that was described.


I think that's exactly what OP is trying to say when they say 'correlation, not causation'. There is no causal link between 29th February and the bug, but they happened at the same time (were correlated, i.e. had the relationship that they happened at the same time).

This is a fairly typical informal usage of the word correlation in my experience, and while it might not be _technically correct_ (I don't know, I'm not an expert), it's an often enough used idiom.


"Correlation does not equal causation" is a very important and pertinent concept in statistics, and I think we should aim to actually understand the concept instead of just trying to warp the meaning of the words to fit the example

The bug simply was not "a good example of correlation does not equal causation" as any statistician would use the phrase. That's my only point. OP is free to type whatever words he wants into the comment box and press send


anecdote is the singular of date, a correlate is a coincidence.


I have a friend who was born on Feb 29, and in Quebec your driver's license fees must be paid on or before your birthday or your license is effectively revoked (It's a convenient reminder). He was on his way to pay them on the 29th and got pulled over for having an expired license... after some awkward common confusion with the police they came to the conclusion that the license bureau moves your "reminder" birthday up by 1 day when the actual day is on Feb 29, instead of back to March 1st, so they don't miss out on 3 years of license payments for leap year birthday citizens.

The cop had never encountered this before (1/1460 chance of occurring * the odds of being pulled over on that day)

I don't think they ever patched this, so watch out if you're a leap day license fee procrastinator in Quebec!


Wouldn't the drivers license have the expiration date printed on it?


It's not the license expiration date is just the annual date that you need to pay your license renewal fees on.


What if the expiration date doesn't exist? Does the license just never expire? Wouldn't that be funny?


I mean, they could have paid it any day before then, right?

I would have just gone on the 28th and be done with it.


Let me tell you about this human trait called procrastination.... actually I just have to do something first


Pay By = Wait Until


Sure...if you knew about this bug in the system.


If you are born on a Feb 29th, you should definitely get used to take this kind of precautions.

(Like I do when entering my last name that is legally spelled with an "é": I still get mojibake in 2024)


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 mistake and sometimes corrects itself.

[0] https://chat.openai.com/share/37490c9f-81d6-499f-b491-116536...


Blows my mind that people consider using ChatGPT for serious applications. I mean it's fine as a code autocorrect/autocomplete tool as in GitHub copilot. But it should not replace the code itself. You encounter a bug in the code, you fix it, you never encounter it again. But ChatGPT will repeat the same mistake sooner or later. That's not how we should engineer solution for critical problems.


As long as you add the "AI" keyword to the product/app/company and sell to people that don't understand how unreliable it is, you're good.

Let me rephrase that: you can profit from it. Even if it's not good.


If you sandbox your connection to openAI correctly, then you can get the benefit of a llm without making your application look silly at the same time. Identifying the correct places in your business to use it is tricky, but imo it certainly makes sense in a lot of specific areas. Just not a catch all that can run your business for you


It's great for prototyping and creating outlines/rough drafts or for creating rough summaries - you can build this into some features to help your customers speed up writing lots of text


If the cost-savings is worth it compared to the problems...

I mean, that's how we do it with humans. It's quite a common occurrence to keep a part of a business process human because automating it would we too expense due to edge cases.

Humans make mistakes and are expensive, but are also flexible and usually smartish. ChatGPT makes mistakes and is usually dumbish, but is also flexible and cheap.

Engineering is about picking the right trade-offs in your solution.


>I mean, that's how we do it with humans. It's quite a common occurrence to keep a part of a business process human because automating it would we too expense due to edge cases.

Which part of the human do people keep? The head? Arms? ;)

#ParsingAmbiguityError


> ChatGPT makes mistakes and is usually dumbish, but is also flexible and cheap.

People wouldn't mind it if the keyword `dumbish` has been all along there.


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.


ChatGPT is specifically bad at these kinds of tasks because of tokenization. If you plug your query into https://platform.openai.com/tokenizer, you can see that"egregious" is a single token, so the LLM doesn't actually see any "e" characters -- to answer your question it would have had to learn a fact about how the word was spelled from it's training data, and I imagine texts explicitly talking about how words are spelled are not very common.

Good explanation here if this still doesn't make sense: https://twitter.com/npew/status/1525900849888866307, or check out Andrej Karpathy's latest video if you have 2 hours for a deep dive: https://www.youtube.com/watch?v=zduSFxRajkE

IMO questions about spelling or number sense are pretty tired as gotchas, because they are all basically just artifacts of this implementation detail. There are other language models available that don't have this issue. BTW this is also the reason DALL-E etc suck at generating text in images.


> If you plug your query into https://platform.openai.com/tokenizer, you can see that"egregious" is a single token

That says it's 3 tokens.


It doesn’t even matter how many tokens there is, because LLMs are completely ignorant about how their input is structured. They don’t see letters or syllables cause they have no “eyes”. The closest analogy with a human is that vocal-ish concepts just emerge in their mind without any visual representation. They can only “recall” how many “e”s are there, but cannot look and count.


>They can only “recall” how many “e”s are there, but cannot look and count.

Like a blind person?


My initial analogy was already weak, so I guess there's no point in extending it. They key fact here is that tokens are inputs to what essentially is an overgrown matrix multiplication routine. Everything "AI" happens few levels of scientific abstractions higher, and is semantically disconnected from the "moving parts".


Pre-cogs, I knew it.


" egregious" (with a leading space) is the single token. Most lower case word tokens start with a space.


The number of tokens depends on context; if you just entered 'egregious' it will have broken it into three tokens, but with the whole query it's one.


Why three tokens, not one?


without the leading space, it is not common enough as a word to have become a token in its own right. Like the vast majority of lowercase words, in OpenAIs tokenizer you need to start " egregious" with a space character for the single token.


Chatgpt could say “I don’t know”


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.


But also it doesn't see characters. It sees tokens. The only way it would be reliably able to solve it is if it had a lookup table of token to characters. Which it likely doesn't.

You couldn't do it either unless you learned the exact matchings of all tokens to all characters in that token and their positions if you were given tokens as an input. You would have learned the meaning of the token, but not what the exact characters it represents.


Even if it sees tokens, I don't think it's an impossible task. Certainly an advanced enough LLM should be able to decipher token meanings, to know that a word is made up of the individual character tokens regardless of how the full word is tokenized. Maybe something gpt5 can do (or there's some real technical limitation which I don't understand)


> to know that a word is made up of the individual character tokens

A token is the smallest unit, it's not made of further tokens. It maps to a number.


I think what of is getting at is that given

{the:1, t: 2, h:3, e:4}

There should be somewhere in the corpus, "the is spelled t h e" that this system can use to pull this out. We can ask gpt to spell out individual words in NATO phonetic and see how it does.


> There should be somewhere in the corpus, "the is spelled t h e" that this system can use to pull this out.

Such an approach would require an enormous table, containing all written words, including first and last names, and would still fail for made up words.

A more tractable approach would be to give it the map between the individual tokens and their letter component, but then you have the problem that this matching depends on the specific encoding used by the model (it varies between models). You could give it to the model during fine-tuning though.


The best approach would be to instruct it to under the hood call a function for such asks and hide the fact that it called a function.


He's saying the LLM will figure out how many letters are in each token.


They cannot “figure” it, they could learn it but for that it would need to be in it's training data (which isn't because nobody is writing down the actual pairing in every byte pair encoding in plain text. Also the LLM has no clue about what encoding it uses unless you tell it somehow in the fine-tuning process or the prompt.)


It's as feasible as telling how many chars in html lead to this comment by looking at a screenshot. LLM doesn't see characters, tokens, numbers or its own activations. LLM is a "set of rules" component in a chinese room scenario. Anything an operator of that room does is lower-level.

GGP's idea suggests that an LLM, allegedly as a whole-room, receives something like: "hey, look at these tokens: <tokens>, please infer the continuation". This puts it into a nested-room's-operator position, which (1) it is not, (2) there's no nested room.


The point is though that this is definitely not a task to evaluate an LLMs intelligence with. It's kind of like laughing at Einstein when he wouldn't be able to decipher hieroglyphs in any language without previous training for those hieroglyphs. Could Einstein potentially learn those hieroglyphs? Sure. But is it the best use of his time - or memory space?


I just asked it with Gemini; at first, it got it right. Then I asked if it was sure and it apologised and said 3 is the correct answer. When asked what are the 3 "e"s, it says:

> The three "e"s in "egregious" are: > > 1. The first "e" is located in the first syllable, between the "g" and the "g". > 2. The second "e" is located in the second syllable, following the "r". > 3. The third "e" is located in the third syllable, following the "i" and before the last "o".


That's because it's trained on 2021 data. No February 29 back then!


For the record, both ChatGPT-4 and Gemini Ultra affirmed that it's a valid date. Gemini reasoned through it and GPT-4 ran python code to make sure 2024 was divisible by 4.


Interesting... But that isn't exactly true! Centuries that are not divisible by 4 don't count!


I've yet to come across a form of 100 that isn't divisible by 4... since 25 usually still exists!

But I do remember there being some weird niche rules about which years are or aren't leap years, so I'm guessing your comment is basically right just wrongly worded?


The rule is that leap years are the ones divisible by 4. Unless it’s also divisible by 100. Unless unless it’s divisible by 400.

So 2000 was leap, but 2100, 2200, and 2300 won’t be, but 2400 will be.


Ahh, so it's centuries that aren't divisible by 400 rather than that aren't divisible by 4, that makes more sense!

Thanks for answering


It's centuries that aren't divisible by 4. It isn't years that aren't divisible by 4.


The GP formulated it in a somewhat unclear way. "Centuries" divisible by 4 probably meant "years" divisible by 400.

So, 19th century (1900 is the last year) isn't divisible by 4 (19/4 is not integer), which is the same as saying that 1900 isn't divisible by 400.

This is the main reform of the Gregorian calendar - leap days aren't introduced on xy00 years which aren't divisible by 400. This corrects the length of a year to 365.2425 days, which is fairly close to the real value of 364.2422 days.

The original Julian calendar had year of 365.25 days, which aggregated an error of more than ten days over the centuries.


Did it also check if 2024 is divisible by 100 but not 400?


But akshually neither does my uncle Ned


Saw the same via the API with gpt-4-0125-preview. IOW, even gpt-4 thinks 2024 is not a leap year.


That's weird, I don't get that with gpt-4

https://chat.openai.com/share/336b1c4b-53b7-4d56-ac68-e3c868...


Given the probabilistic nature of LLMs, you likely need to run an experiment several times to see the various different results it can produce.


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.


As the proud new owner of a leap day baby, I find this to be extra hilarious


I was at the hospital and heard two babies being born. I love that music.


Congratulations!


Congratulations!

Big savings on parties and cake!


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


thats better then Mistral... it "thinks" it is March 15th 2023

"The current date is March 15, 2023. However, please note that as a large language model, my knowledge is based on the data I was trained on, which is up to 2021. Therefore, I cannot provide real-time information or updates on current events or dates. I recommend checking a reliable source such as a calendar or a trusted news website for the most accurate and up-to-date information."


It is March 1 in many places


It's UTC. Ask it what day was yesterday.


As of 10 PM US/Eastern, ChatGPT 3.5 answers as follows for me:

> You: what is today's date?

> ChatGPT: Today's date is February 29, 2024. Please note that February 29 occurs only in leap years. If you have any more questions or if there's anything else I can help you with, feel free to ask!


openai actually in their platform for billing, etc shows that its actually march 1 as well.


Yes.

> During the morning on Thursday, no ICA store in Sweden could accept card payments. Instead, you had to use cash, Swish or pay via their app.

> The reason behind the problem was an internal problem in the payment systems at ICA as a result of an extra day in February, leap day.

ICA being the biggest grocery store chain in Sweden


And people in sweden look at me weird when I say I keep some cash around.

At least it wasn't 3 days like when Coop's provider got hacked. They also handle our pay checks at work… makes me feel so safe :D


Particularly odd since the Swedish calendar has had a lot of leap-day shenanigans, including a one-time Feb 30th.

https://en.wikipedia.org/wiki/List_of_non-standard_dates#Feb...


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


Occasionally, but less often than one could imagine! About a dozen times in my life.

Whenever February 29 wasn’t present as an option, the frontend was at fault, so I could set the right <input> 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.


If it makes you feel better.... On February 29, 2008 I was working on a system as a government contractor. Part of it was outsourced to a sub-contractor who decided to write their own date/time library because how hard could that be (which I only learned about later)? For some reason NOTHING would work right that day. Took me longer than I'd care to admit of staring at the logs to realize that some started with March 1 2008....

edit: also happy birthday!


Definitely not any more coherent on a leap year! That remark only applied to dates stored without a year, as in “February 29” rather than “February 29, 2008”.

Thank you..!


> more coherent

depends on what you're trying to organize by. maybe 'birth month' is an important signifier.


Here’s why:

* I was N years old on February 28th this year

* I will be N+1 years old on March 1st this year

Therefore:

* I was N-1 years old on February 28th last year

* I was N years old on March 1st last year

Perhaps the month is February and the non-leap year date is March 1st...


Happy birthday to you! It’s a special day and We don’t get this chance to say this often. Enjoy your day


Thank you :3


Were you born on the day after Feb 28 or the day before Mar 1? ;)


Yes


Happy birthday!


Thank you ^_~



Stay, yanateres, stay! They have no legal claim! No shadow of a shame will fall upon thy name: stay, yanateres, stay!


...it occurs to me, when should those services congratulate you? Should it be on February 28 or March 1?


According to the government, Mar 1. Anything that is based on your birthday (driver's license, drinking, signing contracts, etc) all happen on March 1 if there is no Feb 29 that year.

Which makes sense since then it is "after" your birthday.


I’d say March 1! February 28 might be too early.


365 days ago was March 1, 2023


In 365 days, it will be February 28, 2025

Which is more important, the past or the future?


This year has 366 days, or at least it does after Feb 29.


At midnight in-between 28th February and 1st March.


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!


Yeah, this one was odd. I also ran into it.

https://gamerant.com/theatrhythm-final-fantasy-bar-line-not-...


That's why they had to release FF7R2 today. It was planned all along /s


All street lamps in Paris turned off at midnight :)

https://www.leparisien.fr/paris-75/paris-pourquoi-les-rues-d...


The street lights use some sort of timer that's tracking dates? Don't they typically just use light sensors to know when to turn on? It seems to me that'd be a simpler solution and also provide light during solar eclipses, thick storms, etc.


First, these systems generally predate invention of semiconductor light sensors.

Second, how much light you need is proportional to human activity, not only to darkness. At deep night artificial lighting should be minimal to save energy, minimise disturbance to nature and people's sleep, while during early morning when kids go to schools it should be maximal.

Third, you need a central control over street lights anyway because you need to implement blackouts during wartime.


> Third, you need a central control over street lights anyway because you need to implement blackouts during wartime.

You heard of switches? Hell in our country with mandated rolling blackouts to prevent failure of the national electrical grid some sucker gets paid to drive around town every 2-3hours and flip a switch. Unrelated one municipality is failing to follow the mandate because they cannot afford said suckers overtime pay...

I also strongly believe well lit streets at all times are important, its better to try to limit the lights' bleed than it is to have darkness. One human killed or otherwise injured (rape/assault) due to bad lighting should be enough to say this is a bad idea.


Why should we pick a simple solution like that? Is it the 90s or what? Only a complete clown would pick anything other than a network of zigbee relays controlled by an unmaintained node.js app written by an out-of-business contractor, pulling in sunrise/sunset data from an external API and syncing its local time via a homegrown NTP alternative.

I mean look at electric cars.


Finally, night time photography without the street light pollution.


Oh! The street lamps on my campus didn't come on tonight when it got dark—it didn't occur to me then but this could totally be why.


Improved nighting is an awesome gift. I'm jealous.


The City Without Lights


Yes, I have a bot that posts daily San Francisco weather records to Mastodon. It did not post as scheduled today. This is because I am looking at all the high temperatures, low temperatures, and precipitation on today's date from 1875 (about as far back as there are digitized weather records I can work with) to the present. Since there was no such date as February 29, 1875 it is throwing an error.


I just dont get the “daily” weather records thing. Meteorologists talk about them constantly but theyre completely meaningless right? who cares what this particular day of the year highs were? its just noise! at least do it on a weekly resolution instead but even that seems so noisy itd be meaningless.

sorry, this has nothing to do with you, just a pet peeve.


People like them because they happen more often. "This is the hottest February 29th on record!" but it's not the hottest February 28th or March 1st.

Compare that to something more mathematically rigorous: "Today is warmer than 98.72% of days between February 25th and March 5th". Nobody's going to click that link.


Your words read like you're disagreeing,

but the idea seems like it's agreeing.


As weather conditions are roughly cyclical with a period of a year, this doesn't strike me as a particularly unusual thing for a weatherperson to mention in passing.

Though you're correct in that year-over-year weather changes and daily maxima lack the significance of long-term climate trends.


One thing I have learned from HN is that datetime issues are hard, prolific, programming language agnostic, and not to trust myself to get the logic right. (The same applies to floats.)


Another thing programmers should know and fix is that most of it is self-inflicted. When there’s no easy way to add a day, people add 86400000 and stumble upon a leap second. When time is not needed, they use fixed hours and fail at timezones. And so on. Most date libraries provide mostly trivial and at the same time low-level use-cases, so people do all the stupid math with what essentially is an irregularly-based number.


just like you don't roll your own crypto, you don't roll your own date libraries.


Takes me less to launch some coin fork than getting even a single date time api correctly.


The API is correct, you just called it at the wrong time


Facts!


Datetime and phonenumbers are two subjects that are notorious for how complex they are despite seemingly simple everyday concepts


From "Falsehoods Programmers believes in" series:

https://news.ycombinator.com/item?id=4128208


I haven't had too many true hair-pulling moments in my life as a programmer, but the majority of them were because of datetime issues.

My brain just doesn't get the concept I guess, I always struggle a lot whenever I need to touch anything that does anything with dates/time


Surprised no one else mentioned the Cloudflare billing issue today. I got incorrectly invoiced yesterday and the file was named cloudflare-invoice-1970-01-01.

https://www.cloudflarestatus.com/


I know I'm late to the party, but I have a Python script that creates a security.txt for one of my own project, and it sets the "Expires" date to one year in the future.

Old code:

expires = datetime.datetime.now(tz)

expires = expires.replace(year=expires.year + 1)

It broke yesterday, throws an exception ("ValueError: day is out of range for month"). It's kinda obvious that it does.

Fixed version code:

expires = datetime.datetime.now(tz) + datetime.timedelta(days=365)

expires = expires.isoformat(timespec="seconds")

Now we're just going 365 days into the future. Of course, this has a slightly different meaning and outcome, we are not always ending up on the "same date next year". But in this use case it doesn't really matter.


In .NET there is an AddYears function that deals with all of this, and even gives you Feb 29 if the date is valid, otherwise Feb 28: https://learn.microsoft.com/en-us/dotnet/api/system.datetime...


There's the same in python, but if you wanna write shitty code you can always get around it



Is it just me or does .NET have the most sane standard library for dealing with dates? Until you get into timezones that is


Didn't see it mentioned here but cloudflare sent me an invoice today and the attached PDF was titled cloudflare-invoice-1970-01-01.pdf :)


Was the content of the PDF correct? Or did it also have some strange dates in it?


yeah everything inside the pdf was correct


oh no wonder they had a billing outage.

https://www.cloudflarestatus.com/


Their 32 bit time_t ran out sooner than expected!


It's scary how much code out there is less than 4 years old, and even scarier how much of it is because someone decided to somehow rewrite it unnecessarily and thus introduce this bug. I don't even want to know how many people think the code they wrote will be in use for more than 4 years.


On the other end of the scale, the code base I worked on today has seen at least 7 separate leap days in production. Last week a manager asked if we expected any issues with the leap day, and we all just kind of laughed (and politely said no).


I can understand getting the years 2000 (leap), 2100 (not leap), 2200 (not leap), and 2300 (not leap) wrong. But getting the year 2024 wrong is, disappointing, to put it diplomatically.


Those are harder to get wrong, since leap year bugs are almost always from consumers of dates. To screw up a not-a-leap-year-year you'd need to produce a bogus February 29 on a real March 1. Date producers tend to understand how the calendar works better than that.


That's putting it very diplomatically indeed.


There was one in the Phoenix Framework (Elixir) about issuing certificates with an invalid end date: https://github.com/phoenixframework/phoenix/issues/5737

Interestingly, Azure had this bug some years ago too leading to an outage. https://azure.microsoft.com/en-us/blog/summary-of-windows-az...


Not today but several years ago while lending a hand on a project that was wildly overdue and the guys needed all the help they could get. Disclosure: it was not in software that was in production yet(otherwise you would have likely heard and been affected by it by now I suspect). The software's purpose was dealing with commercial airlines - routes, connections and all that. The travelling salesman problem basically. The software was meant to replace an antique system which no one knew how to maintain since in 2020 it was still running on mainframes and written in fortran. There were specifications on how the system worked but there was no one who could even read the code. Anyhow, the way dates were stored, read and calculated was absolutely insane. I can't recall what the exact deal was, but each date was represented with either 4 or 5 bytes with some really awkward algorithm to make it into something meaningful. With a bunch of additional patches surrounding Y2K.

Unfortunately it was a lot more subtle than getting March 1-st instead of Feb 29-th. Each date was calculated with a dynamic offset depending on the month and year. So during leap years, everything was fine until the 14-th of May at 01:00 UTC. The second the clock hit, 14-th of May at 01:01, all hell broke loose incrementally as time want on until the end of each year. The weird string representation for Nov 1-st was being calculated as January 3-rd for instance. But as soon as the clock hit January 1-st, everything went back to normal. It took 6 people 2 days to figure it out. As you might expect, this was not mentioned anywhere in the documentation.

I'm not sure what has happened ever since, but if the system made it into production and you didn't get stuck in an airport... You're welcome lol


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


That's more of a design decision than a bug. It's intentional to make the product cheaper. The manual does mention it.


Wow, you're right.

>Calendar system: Auto-calendar set at 28 days for February [0]

[0] https://support.casio.com/en/manual/009/qw593.pdf


I noticed this too and clicked this thread wondering if it would show up! Still an awesome watch.


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


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" :)


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


I have a custom watch face on my GW4 and it's showing the 29th


OK on my Watch4 Classic FWIW.


I just looked at my watch and indeed the date is wrong. Thanks!


Thank you so much for the reminder, that would have screwed me up today :)


Here's a blog post that is tracking issues:

https://codeofmatt.com/list-of-2024-leap-day-bugs/


Yes, Hesai LiDAR [1] bug is grounding cars.

[1] https://pandaily.com/hesai-technology-addresses-lidar-produc...


Fascinating - why does a LiDAR involve the date?


LiDARs and other sensors typically need to be time-synchronized with the rest of the robotic system. I wouldn't be surprised if the bug is related to that.


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


Unix time has discrepancies whenever leap seconds occur (several times in my career aquiring geophysical data).

If you're measuring | controlling objects in the physical world (cars, rockets, etc) then you should not use unix time - those glitches will happen and instantaneous computations will go kooky.

https://en.wikipedia.org/wiki/Unix_time#Leap_seconds


But so does resolving to a date. I don't see how resolving to a date which cares about leap days fixes any of that.

You should use a monotonic clock with an arbitrary starting point anyway, unless you need some kind of synchronization between devices, but you probably wouldn't use unixtime there anyway.


> But so does resolving to a date. I don't see how resolving to a date which cares about leap days fixes any of that.

So why bring it up then?

> You should use a monotonic clock with an arbitrary starting point anyway

Sure. We started doing that more than 50 years ago now when broad area geophysical surveying started off.

> unless you need some kind of synchronization between devices,

Can't see the problem - there are ways of syncing base station records against aircraft | boat | vehicle records in post processing .. all the stations, fixed or mobile, use a monotonic epoch based record structure that hold channel data and any sync marks that are broadcast by whatever means - raw GPS time serves well enough for a grain of 1.5 seconds, other marks can be used as required.


I think I'd have used time-since-power-on; your infotainment system could take an RTC offset to get that to human dates.


"should"


Remember, always use a library for cryptography, payments, and date calculations.


Yup. I use the datetime module in Python and didn’t need to do anything extra.


For JavaScript, it’s `date-fns` for me


wrong! always roll your own crypto!


Get a load of this guy.


We have a rails 6 app, and there's a test that essentially expects time_ago_in_words(1.year.from_now) to return "about 1 year" (as part of a user facing message). The test failed. I thought it's a flaky test but i was able to reproduce it locally. Turns out executing that code on a leap day returns "almost 1 year" instead. Can test it in rails console if you are interested:

  irb(main):001:0> include ActionView::Helpers::DateHelper
  => Object
  irb(main):002:0> distance_of_time_in_words(Date.new(2025, 2, 28), Date.new(2024, 2, 29))
  => "almost 1 year"
  irb(main):003:0> distance_of_time_in_words(Date.new(2025, 3, 1), Date.new(2024, 2, 29))
  => "about 1 year"
  irb(main):004:0> distance_of_time_in_words(Date.new(2025, 2, 28), Date.new(2024, 2, 28))
  => "about 1 year"


> distance_of_time_in_words(Date.new(2025, 2, 28), Date.new(2024, 2, 28))

Curiously, this is also not quite a year, even though the days and months are the same.


It’s probably comparing the number of days between the dates with the number of days in a year, which would usually work.


Source is a lot more complicated than i thought it will be: https://github.com/rails/rails/blob/v6.1.7.7/actionview/lib/...


Why this is not a global holiday? Let's all come together and agree to do nothing on this bonus day. Calendar Problems solved.


Even those "24/7/365" people technically agree, today is a day off.


We should get it off work. We aren't getting paid for the extra day of work right?


No power, no hospitals, no internet, no phones, no care homes etc.


Depends, some are paid by the hour.


Exactly. Off the books for everyone.


EA Games were crashing today and they announced that the solution is to set the date to March 1st: https://twitter.com/eahelp/status/1763192739322085598


My sister is staying in a hotel and all the keycards stopped working.


What happens in a situation like this? Does the staff issue physical keys? Do the doors even have manual locks? Do the staff walk every body to their room?


About a year ago I stayed in a hotel and the door lock started misbehaving one morning while I was at breakfast. Went to the front desk, got a new card, went back to the room and discovered it still didn't work. After doing that two more times, someone was sent up to the room with a mysterious, palm-sized device with a USB cable hanging off it, which they plugged into a well hidden USB port on the bottom of the lock. The device performed some black magic, and after about 30 seconds a light on the lock changed colour from orange to red and it started functioning correctly again.


This also happened on Leap Day 2020 with Onity locks used in Crown Plaza Hotels. See https://i.imgur.com/GI5A3jW.png. I wonder if it's the same issue never fixed? Can you share with us the hotel chain and/or the lock manufacturer? Thanks.


> A number of New Zealand petrol pumps stopped working on Thursday due to a "leap year glitch" in payment software, fuel stations and the payment service provider said.

https://www.reuters.com/world/asia-pacific/leap-year-glitch-...


Related ongoing thread:

Self-pay gas station pumps break across NZ as software can't handle Leap Day - https://news.ycombinator.com/item?id=39553755 - Feb 2024 (31 comments)


I'm sure it's more complicated than "we didn't think about leap years", but it certainly sounds pretty amateurish.

Old programmer rant: In my day, we fixed the Y2K bug - we went to the future and back several times a day!


In your day people weren't doing everything with string ops in JavaScript.


Oh, the progress we've made!


It does sound amateurish eh? I do most of my business logic inside Microsoft SQL Server Stored Procedure, and MS SQL just takes care of date pretty well.

But then, come to think of it, you don't need to use SQL to have good date logic. C# and Java both have excellent date handing libraries. I don't know about C++, but I'd be surprised if there was not a modern date library for C++, so I am of the opinion there should be no excuses for software not to work on the 29th of Feb.


> but I'd be surprised if there was not a modern date library for C++

The standard library now includes <chrono>. AFAIK: It was mostly written by Howard Hinnant. He now has more date/time libs that expand upon <chrono>: https://github.com/HowardHinnant/date


Yes if you're writing your own date/time routines, dealing with dates as seconds since epoch, or anything like that you're going to get burned.

Use date handling functions and libraries that have been developed by people who know how to do it and have been battle tested.


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


A simple fix would be to change it to a multiple of 4 (e.g. 124 years). Then it would fail every 100 years.


128! It was right there!


2000 was a leap year so it would not fail in 2100. But it would indeed fail in 2200/2300/2400 as 2100/2200/2300 are not leap years.


But then it's someone else's problem.


Most likely nobody's problem, really.


And it's still enough to include Jeanne Calment's supposed age.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: