The Nise data seems to be generated incorrectly if the time period involves the year-end period, e.g., December + January data. Consequently, raw calcs tests are currently failing.
The issue is probably in _create_month_list function:
while current <= end_date: ... if current.month < end_date.month: month["end"] = (month.get("end") + relativedelta(days=1)).replace(hour=0, minute=0)
I believe we need: January 2022 > December 2021,
but the code evaluates it as 1 < 12, i.e, January 2022 < December 2021
end_month_first_day = end_date.replace(day=1) while current <= end_date: .... if current < end_month_first_day: month["end"] = (month.get("end") + relativedelta(days=1)).replace(hour=0, minute=0)
We have to fix also the corresponding unittest test_create_month_list, which uses the following test data:{*}
{*}
June-July data:
- the end date for June is July 1 (expected??)
{ "start_date": datetime.datetime(year=2021, month=6, day=1), "end_date": datetime.datetime(year=2021, month=7, day=29), "expected_list": [ { "name": "June", "start": datetime.datetime(year=2021, month=6, day=1), "end": datetime.datetime(year=2021, month=7, day=1, hour=0, minute=0), }, { "name": "July", "start": datetime.datetime(year=2021, month=7, day=1), "end": datetime.datetime(year=2021, month=7, day=29, hour=23, minute=59), }, ], },
November-December-January data:
- November 30 is used as the end date for November (unexpected??) instead of December 1
- December 31 is used as the end date for December (unexpected??) instead of January 1
{ "start_date": datetime.datetime(year=2018, month=11, day=15), "end_date": datetime.datetime(year=2019, month=1, day=5), "expected_list": [ { "name": "November", "start": datetime.datetime(year=2018, month=11, day=15), "end": datetime.datetime(year=2018, month=11, day=30, hour=23, minute=59), }, { "name": "December", "start": datetime.datetime(year=2018, month=12, day=1), "end": datetime.datetime(year=2018, month=12, day=31, hour=23, minute=59), }, { "name": "January", "start": datetime.datetime(year=2019, month=1, day=1), "end": datetime.datetime(year=2019, month=1, day=5, hour=23, minute=59), }, ], },