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
|
if duration._months: |
|
# This is the dangerous one... |
|
new = new.add_months(duration._months) |
|
def add_months(self, num_months: int) -> 'TimePoint': |
|
"""Return a copy of this TimePoint with an amount of months added to |
|
it.""" |
Correct:
Also correct (last day of month):
Incorrect:
(should be
2023-10-31)This will probably need similar re-work as done in #234
See
isodatetime/metomi/isodatetime/data.py
Lines 1684 to 1686 in 41bc38f
isodatetime/metomi/isodatetime/data.py
Lines 1835 to 1837 in 41bc38f