I'm getting the following for the date 2021/05/07 - I ran the following in the repl and was able to reproduce the issue:
>> import calendar
>>> import datetime
>>> y, m, d = dt.year, dt.month, dt.day
>>> dt = datetime.date(2021, 5, 31) - datetime.timedelta(days=360). # this is what the logic does
>>> y, m, d = dt.year, dt.month, dt.day
>>> datetime.date(y, m, calendar.monthrange(y, m)[0])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: day is out of range for mont
Here is the error though:
