Fix yearday=366 resolving to Dec 30 in leap years
relativedelta converts a yearday after February to a common-year month
and day, and sets leapdays=-1 so that it is moved back over Feb 29 when
applied to a leap year. Day 366 becomes December 32, which is already
clamped to December 31, so the extra -1 moved it to December 30, the
same date as yearday=365.
Only set leapdays=-1 for yeardays 60 through 365. The test checks that
every yearday matches the corresponding ordinal day in leap and common
years, including 1900 and 2000.
Co-authored-by: Paul Ganssle <git@m.ganssle.io>
4 files changed