• seth@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I agree with you. Every language I’ve used in the past 15 years has a datetime library or at least standard cookiecutter functions available for conversions, calculations, and adjustments for leap years and daylight savings. Store everything as a datetime in a ISO format with TZ offset or a Zulu indicator, and just convert on the client end if you need to, with a toggle for UTC/local and an option to choose your preferred local.

    If you have some exotic or fuzzy edge case requirement like alternative calendar systems or dates before and after the Julian - Gregorian changeover, the wheel has already been invented and there’s a decade-old stackoverflow thread discussing it ad nauseum, with a 200+ point answer that gets updated every couple years as new tools or major updates become available.