tidyverse / lubridate

Make working with dates in R just that little bit easier
https://lubridate.tidyverse.org
GNU General Public License v3.0
728 stars 207 forks source link

`make_datetime()` failed to add one day with the last day of month and 24-hour #1098

Closed hongyuanjia closed 1 year ago

hongyuanjia commented 1 year ago

With PR #1078, make_datetime() behaves differently than the previous version. I believe this is a regression, since the previous CRAN version (v1.8.0) gives the "correct" answer.

remotes::install_version("lubridate", "1.8.0") # Previous version
lubridate::make_datetime(month = 1, day = 31, hour = 24)
# [1] "1970-01-02 UTC"

remotes::install_version("lubridate", "1.9.0") # CRAN version
lubridate::make_datetime(month = 1, day = 31, hour = 24)
# [1] "1970-01-31 UTC"
vspinu commented 1 year ago

Thanks! It was an undocumented behavior and we didn't test for it, so missed it.