Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
floor_date(x, unit = 'weeks') ignores lubridate.week.start option #509
As the above snippet shows, even though the results of
I believe the issue is actually due to the
In the latter case,
@pjrdata I have a quick hack of a solution here which you may find useful:
I haven't fully tested this, so my apologies if there's a mistake!
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  "2018-11-27 23:45:00 UTC" > lubridate::round_date(date, "week")  "2018-11-25 UTC" > lubridate::floor_date(date, "week")  "2018-11-25 UTC" > lubridate::ceiling_date(date, "week")  "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)  "2018-11-25 UTC" > lubridate::floor_date(date, "week", week_start = 1)  "2018-11-26 UTC" > lubridate::ceiling_date(date, "week", week_start = 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
Hi it seems this issue has resurfaced. I'm using lubridate 1.7.4
Here's the session info in case there is any namespace issues.
Matrix products: default
attached base packages:
other attached packages:
loaded via a namespace (and not attached):