From f0edf4a2a7afb2843d34be972482a92455ecdcc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 8 Jun 2024 12:10:40 +0200 Subject: [PATCH] Do not correct normalized delta when start date is February 29 Closes #13310 (grafted from 24e4858afe729f717eb6882837808ce479f9dfdc) --HG-- branch : 6.0 --- modules/account_asset/asset.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/account_asset/asset.py b/modules/account_asset/asset.py index 236fb46cd7..0c4fc9b94b 100644 --- a/modules/account_asset/asset.py +++ b/modules/account_asset/asset.py @@ -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: