Repository navigation
wrong return type in ceiling_date when unit = "week" #479
Copy link
Copy link
Closed
Description
Activity
- added a commit that references this issue
on Sep 27, 2016 I've filed a PR.
It should return a date object instead of a datetime.
Why do you think so?
If it returns date for week, shouldn't it return date for "day", "month" and "year" as well?
It's true that day month and year returns a date. Isn't it?
@vspinu Here's is what's returned in
lubridate version 1.6.0. As you can see, onlyunit = "week"behaves differently.ceiling_date(ymd("20160927"), "year") ## [1] "2017-01-01" ceiling_date(ymd("20160927"), "month") ## [1] "2016-10-01" ceiling_date(ymd("20160927"), "week") ## [1] "2016-10-02 08:00:00 CST" ceiling_date(ymd("20160927"), "day") ## [1] "2016-09-28"
Yes. You are right. I got confused for a second due to recent re-designing of rounding API.
- added a commit that references this issue
on Sep 27, 2016 It's a very powerful and useful package. Certainly it takes lots of effort to improve. 🍺
- added a commit that references this issue
on Sep 27, 2016 Seems like this issue is alive again in
lubridate_1.6.0:ceiling_date(ymd("20160927"), "year") # [1] "2017-01-01" ceiling_date(ymd("20160927"), "month") # [1] "2016-10-01" ceiling_date(ymd("20160927"), "week") # [1] "2016-10-02 02:00:00 CEST" ceiling_date(ymd("20160927"), "day") # [1] "2016-09-28"It is ok in current development version of lubridate 1.6.0.9009.
library(lubridate) ceiling_date(ymd("20160927"), "year") #> [1] "2017-01-01" ceiling_date(ymd("20160927"), "month") #> [1] "2016-10-01" ceiling_date(ymd("20160927"), "week") #> [1] "2016-10-02" ceiling_date(ymd("20160927"), "day") #> [1] "2016-09-28"
Metadata
Metadata
Assignees
Labels
No labels
Hi, @vspinu, I tried the CRAN version of
lubridateand found a bug related toceiling_datewhen theunit = "week". It should return a date object instead of a datetime.Here's the reproducible example: