Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make round_date() really use week_start= #1

Merged
merged 1 commit into from
Nov 27, 2018
Merged

Commits on Nov 27, 2018

  1. 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 👍 !
    xvrdm authored Nov 27, 2018
    Configuration menu
    Copy the full SHA
    fe5f869 View commit details
    Browse the repository at this point in the history