isodatetime
isodatetime copied to clipboard
Adding duration in months to a TimePoint can give incorrect result for 31st of month
Correct:
>>> TimePoint(year=2023, month_of_year=7, day_of_month=31) + Duration(months=1)
2023-08-31
Also correct (last day of month):
>>> TimePoint(year=2023, month_of_year=8, day_of_month=31) + Duration(months=1)
2023-09-30
Incorrect:
>>> TimePoint(year=2023, month_of_year=8, day_of_month=31) + Duration(months=2)
2023-10-30
(should be 2023-10-31)
This will probably need similar re-work as done in #234
See
https://github.com/metomi/isodatetime/blob/41bc38ff234c903e6ab6ed60e95dcc90b088d9b6/metomi/isodatetime/data.py#L1684-L1686
https://github.com/metomi/isodatetime/blob/41bc38ff234c903e6ab6ed60e95dcc90b088d9b6/metomi/isodatetime/data.py#L1835-L1837