• hinterlufer@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        13 hours ago

        I don’t think this is implemented in the standard datetime library, but in principle overriding sub is easily possible and you can define it as you’d wish.

        However, I think subtracting a year is a bit ill defined, because it isn’t clear which year you’re subtracting given the leap year issue.

        • Feathercrown@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          12 hours ago

          If you’re subtracting a year from a date, you could just keep the date constant while changing the year, and adjust Feb 29 as needed.