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 = datet…
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...
Ask HN: Did you encounter any leap year bugs today?
461–470 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#462Earlier 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…
Re: Ask HN: Did you encounter any leap year bugs today?
#463Surprised 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/
Re: Ask HN: Did you encounter any leap year bugs today?
#464Earlier quoted context omitted.
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
Re: Ask HN: Did you encounter any leap year bugs today?
#465Earlier quoted context omitted.
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.
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.
Re: Ask HN: Did you encounter any leap year bugs today?
#466Earlier quoted context omitted.
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…
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
Re: Ask HN: Did you encounter any leap year bugs today?
#467Earlier quoted context omitted.
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 anywa…
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.