Hello,
I am trying to add one month to a date using lubridate, while making sure the day of the month makes sense when switching (that is moving from a 31 days month to a 30 days month for instance).
I found this solution which works for me:
> ymd('2019-12-01') %m+% months(1)
[1] "2020-01-01"
However I do not undestand what is going on here. First of all, this uses base months()
instead of lubridate::months()
. Could someone please explain the rationale here? Can I do the same with lubridate
only?
Thanks!