0

I have the last day of the month, in this case 30th June 2020, and I am trying to change it to 1st June 2020. What I did is this

end_date + relativedelta(days=+1, months=-1)

but what it returns is May 31st 2020, when I want June 1st 2020. I realised the error comes from months=-1, which returns May 30th by itself, but shouldn't it return May 31st, since I am subtracting 1 month from June 30th? I thought relativedelta was able to tell which months have 31 days and which have 30 days?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
jason
  • 562
  • 8
  • 24

0 Answers0