Closed torfason closed 1 year ago
This is a valid point. Needs to be fixed.
A complication is that even internal round.POSIXt
is not doing it correctly
> tinf <- .POSIXct(c(Inf, -Inf))
> round.POSIXt(tinf)
[1] "Inf" "-Inf"
> round.POSIXt(tinf, "day")
[1] NA NA
You would need to install timechange from github for now.
I can confirm that installing the GitHub version of timechange fixes this for me.
Thanks, that was fast :-)
The
floor_date()
function returnsNA
for infinite times (positive or negative). This seems wrong.An
Inf
time is a time after all others, and flooring or rounding that to the nearest day, hour, minute or second, should also result in a time after all others, rather than a missing value. This can be quite useful, and other issues have discussed how this is a legitimate use (see e.g. #1020, but note that this is not a duplicate of that issue, the value offloor_date()
does not just print asNA
it reallly isNA
).This applies to
-Inf
and toceiling_date()
as well.But notably not to
round_date()
!See reprex below.