Remember, always use a library for cryptography, payments, and date calculations.
Ask HN: Did you encounter any leap year bugs today?
281–290 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#282Earlier quoted context omitted.
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"
Re: Ask HN: Did you encounter any leap year bugs today?
#283Didn't see it mentioned here but cloudflare sent me an invoice today and the attached PDF was titled cloudflare-invoice-1970-01-01.pdf :)
Re: Ask HN: Did you encounter any leap year bugs today?
#284Earlier quoted context omitted.
Is March more logical? Feb 29 + 1 year = Feb 28.
What’s the significance of 365? Each Earth year has just a smidge under 365.25 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...
Re: Ask HN: Did you encounter any leap year bugs today?
#285Earlier quoted context omitted.
> 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
Re: Ask HN: Did you encounter any leap year bugs today?
#286It'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.
Re: Ask HN: Did you encounter any leap year bugs today?
#287Why this is not a global holiday? Let's all come together and agree to do nothing on this bonus day. Calendar Problems solved.
Re: Ask HN: Did you encounter any leap year bugs today?
#288Re: Ask HN: Did you encounter any leap year bugs today?
#289Earlier quoted context omitted.
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 s…
> 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.
Re: Ask HN: Did you encounter any leap year bugs today?
#290Earlier quoted context omitted.
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!
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…
Use date handling functions and libraries that have been developed by people who know how to do it and have been battle tested.