DEV Community

Cover image for Rethinking Leap Years: Why Your Favorite Programming Language's Approach May Be Flawed

Rethinking Leap Years: Why Your Favorite Programming Language's Approach May Be Flawed

Maxi Contieri on February 29, 2024

A historical mistake and how you can solve it TL;DR: Most languages fail to find the correct behavior for leap year calculation. Disclaimer...
Collapse
 
yoursunny profile image
Junxiao Shi

Does leap year even matter?
As far as Excel knows, 2025-02-29 is same as 2025-03-01.
For the rest of us, we use Unix timestamp, and only need to dodge the leap second.