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

Comments (481) 159 threads

Show all comments

Showing thread 12 of 159

hannob1 reply#
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.

willsmith721 reply#
There's the same in python, but if you wanna write shitty code you can always get around it
wwilim#
Is it just me or does .NET have the most sane standard library for dealing with dates? Until you get into timezones that is