Do not correct normalized delta when start date is February 29

Closes #13310
(grafted from 24e4858afe729f717eb6882837808ce479f9dfdc)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier
2024-06-08 12:10:40 +02:00
parent bb5322686e
commit f0edf4a2a7
+4 -1
View File
@@ -35,7 +35,10 @@ def normalized_delta(start, end):
delta = end - start
correction = 0
if start.year == end.year:
if calendar.isleap(start.year) and start.month <= 2 and end.month > 2:
if (calendar.isleap(start.year)
and (start.month < 2
or (start.month == 2 and start.day < 29))
and end.month > 2):
correction -= 1
else:
if calendar.isleap(start.year) and start.month <= February: