From documentation, it seems to correctly get last day of the month..
How does it handle months with different numbers of days? Notice that adding one month will never cross the month boundary.
>>> date(2003,1,27)+relativedelta(months=+1)
datetime.date(2003, 2, 27)
>>> date(2003,1,31)+relativedelta(months=+1)
datetime.date(2003, 2, 28)
>>> date(2003,1,31)+relativedelta(months=+2)
datetime.date(2003, 3, 31)
I tried,
from datetime import date
print(date(2021, 6, 30) + relativedelta(months=-1))
which gives 2021-05-30. i should have been 2021-05-31.
From documentation, it seems to correctly get last day of the month..
How does it handle months with different numbers of days? Notice that adding one month will never cross the month boundary.
I tried,
which gives 2021-05-30. i should have been 2021-05-31.