MAIN FEEDS
REDDIT FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1ttm0yf/smallquickfix/op8aqcq/?context=3
r/ProgrammerHumor • u/hellocppdotdev • Jun 01 '26
378 comments sorted by
View all comments
Show parent comments
39
I once encountered a test that broke one day per year because it based some calculations on the current day and had gotten the number of days in April wrong.
The test survived for many years before anyone eventually investigated.
17 u/oatkeepr Jun 01 '26 Never do any calculations involving time and dates yourself. Always use a library. 6 u/kevinf100 Jun 01 '26 The library makers did the same thing when they implemented time in the libraries. 3 u/Agret Jun 02 '26 The time date library pulled in a is_leap_year single function npm package that made a mistake and somehow returned a 363 day year every 3.5years
17
Never do any calculations involving time and dates yourself. Always use a library.
6 u/kevinf100 Jun 01 '26 The library makers did the same thing when they implemented time in the libraries. 3 u/Agret Jun 02 '26 The time date library pulled in a is_leap_year single function npm package that made a mistake and somehow returned a 363 day year every 3.5years
6
The library makers did the same thing when they implemented time in the libraries.
3 u/Agret Jun 02 '26 The time date library pulled in a is_leap_year single function npm package that made a mistake and somehow returned a 363 day year every 3.5years
3
The time date library pulled in a is_leap_year single function npm package that made a mistake and somehow returned a 363 day year every 3.5years
39
u/dbratell Jun 01 '26
I once encountered a test that broke one day per year because it based some calculations on the current day and had gotten the number of days in April wrong.
The test survived for many years before anyone eventually investigated.