One cleanup script broke because Python doesn’t have a clean way to subtract a year, and if you do now.replace(year=now.year-1), you get a ValueError when now is 2/29. It’s easy enough to address. There are various StackOverflow posts on such things. Here is one: https://stackoverflow.com/questions/54394327/using-datetime-...
What is your definition of "subtracting a year"? Seems like that's a relatively ambiguous operation without more specification.
Ask HN: Did you encounter any leap year bugs today?
31–40 of 498 posts
Re: Ask HN: Did you encounter any leap year bugs today?
#32One cleanup script broke because Python doesn’t have a clean way to subtract a year, and if you do now.replace(year=now.year-1), you get a ValueError when now is 2/29. It’s easy enough to address. There are various StackOverflow posts on such things. Here is one: https://stackoverflow.com/questions/54394327/using-datetime-...
What is your definition of "subtracting a year"? Seems like that's a relatively ambiguous operation without more specification.
Re: Ask HN: Did you encounter any leap year bugs today?
#33Re: Ask HN: Did you encounter any leap year bugs today?
#34One cleanup script broke because Python doesn’t have a clean way to subtract a year, and if you do now.replace(year=now.year-1), you get a ValueError when now is 2/29. It’s easy enough to address. There are various StackOverflow posts on such things. Here is one: https://stackoverflow.com/questions/54394327/using-datetime-...
Re: Ask HN: Did you encounter any leap year bugs today?
#35One cleanup script broke because Python doesn’t have a clean way to subtract a year, and if you do now.replace(year=now.year-1), you get a ValueError when now is 2/29. It’s easy enough to address. There are various StackOverflow posts on such things. Here is one: https://stackoverflow.com/questions/54394327/using-datetime-...
Re: Ask HN: Did you encounter any leap year bugs today?
#36 cls = , data_string = 'Feb 29 04:55:03.687' format = '%b %d %H:%M:%S.%f'
E ValueError: day is out of range for monthRe: Ask HN: Did you encounter any leap year bugs today?
#37To be fair, it doesn't ask for year anywhere in settings. It simply doesn't know what year it is.
Re: Ask HN: Did you encounter any leap year bugs today?
#38Just hope the King of Sweden doesn't make another February 30. https://www.timeanddate.com/date/february-30.html
Re: Ask HN: Did you encounter any leap year bugs today?
#39One of the largest food store chains in Sweden had their entire card payment go down because someone forgot to handle leap years!
Is this why we can't have nice things?
Re: Ask HN: Did you encounter any leap year bugs today?
#40Not working on the game or anything but found it moderately amusing as someone who owns the game!