Fix recorder "year" period in leap year (#132167)

* FIX: make "year" period work in leap year

* Add test

* Set second and microsecond to non-zero in test start times

* FIX: better fix for leap year problem

* Revert "FIX: better fix for leap year problem"

This reverts commit 06aba46ec6.

---------

Co-authored-by: Erik <erik@montnemery.com>
This commit is contained in:
Pete
2024-12-04 13:21:10 +01:00
committed by GitHub
parent 545a780fcb
commit a417d3dcf8
2 changed files with 67 additions and 27 deletions

View File

@@ -902,7 +902,7 @@ def resolve_period(
start_time = (start_time + timedelta(days=cal_offset * 366)).replace(
month=1, day=1
)
end_time = (start_time + timedelta(days=365)).replace(day=1)
end_time = (start_time + timedelta(days=366)).replace(day=1)
start_time = dt_util.as_utc(start_time)
end_time = dt_util.as_utc(end_time)