TLDR Dev · ARTICLES & TUTORIALS
HOW WRONG CAN A JAVASCRIPT DATE CALCULATION GO?
Summary from the TLDR Dev newsletter
A JavaScript dev tried adding one month to January 1, 2024, and somehow got March 4, 2023. The culprit was timezone handling, as midnight UTC was still December 31 in Pacific Time, so adding a month landed on the non-existent “February 31”, which overflowed into March.