Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make round_date() really use week_start=
After reading the documentation and many SO questions, I still couldn't really explain the difference between `round_date()` and `ceiling/floor_date` when using `unit="week"` and `week_start=1`. I thought it might just be that `round_date()` ignore `week_start=`, a bit like `floor/ceiling_date` back in the tidyverse#509 days. Without `week_start=`, everything looks as expected. ``` > date <- parse_date_time("November 27 2018 23:45", orders="bdyHM") > date [1] "2018-11-27 23:45:00 UTC" > lubridate::round_date(date, "week") [1] "2018-11-25 UTC" > lubridate::floor_date(date, "week") [1] "2018-11-25 UTC" > lubridate::ceiling_date(date, "week") [1] "2018-12-02 UTC" ``` But if you ask for weeks starting on Mondays (or any other day). Only `floor/ceiling_date` seem affected: ``` > lubridate::round_date(date, "week", week_start = 1) [1] "2018-11-25 UTC" > lubridate::floor_date(date, "week", week_start = 1) [1] "2018-11-26 UTC" > lubridate::ceiling_date(date, "week", week_start = 1) [1] "2018-12-03 UTC" ``` Apart from this tiny glitch, thanks for the awesome library: I don't want to use anything else when it comes to dates 👍 !
- Loading branch information