Ask HN: Did you encounter any leap year bugs today?
481–490 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#482Re: Ask HN: Did you encounter any leap year bugs today?
#483One 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.)
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
Re: Ask HN: Did you encounter any leap year bugs today?
#484Re: Ask HN: Did you encounter any leap year bugs today?
#485Re: Ask HN: Did you encounter any leap year bugs today?
#486Re: Ask HN: Did you encounter any leap year bugs today?
#487Re: Ask HN: Did you encounter any leap year bugs today?
#488Re: Ask HN: Did you encounter any leap year bugs today?
#489Re: Ask HN: Did you encounter any leap year bugs today?
#490Earlier 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…
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.