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 upceiling_date behavior (at boundary) is undocumented #262
Comments
|
This appears to be an undocumented behavior so that it behaves like
This probably should be added to the documentation. |
|
I have just documented this.
You would like to have the following consistency |
|
Hi, @vspinu @imanuelcostigan, related to:
Can you give me some hint so that I can have a better understand the meaning of this According to my current understanding, for each date in March, no matter it's the first day or the last day, with |
|
Your understanding is correct. Except that second 0 is on the boundary, so ceiling will give you exact the same date for |
|
@vspinu Thanks for the quick response. I get your point, but I would insist on my opinion that at least for the pure I've been frustrated 3 years ago when I started using |
|
Hm. That you workaround fails looks like a bug.
This appeals to the intuition indeed. The problem is that it's difficult to reconcile this with the fact that we align dates to corresponding 00 second POSIX times. I doubt that this convention is enforced anywhere except truncation. Let's revisit it. Please open a new issue. I will think a bit more about a coherent semantics and will try to fix this asap. |
|
Thanks, I'll file a new issue later |
ceiling_dateseems to give erroneous results. Consider the following example:I expect the second result to be "2012-11-01 UTC", i.e. like the third. This is consistently wrong as seen by the fourth argument.
The problem appears to be with the following expression in
ceiling_date:y <- floor_date(x - eseconds(1), unit)I don't believe that there is a reason to subtract a second. Changing this to:
y <- floor_date( x, unit )fixes the issue.
Also, I realize that the ship has probably sailed on this, but shouldn't the ceiling for a month be the last second in the month, e.g.
2012-10-31 12:59:59rather than the first second of the following month?