tidyverse / lubridate

Make working with dates in R just that little bit easier
https://lubridate.tidyverse.org
GNU General Public License v3.0
728 stars 207 forks source link

Printing issue with lubridate::as_datetime(Inf) output #1020

Closed fzenoni closed 2 years ago

fzenoni commented 2 years ago

There is a confusing behavior when executing:

lubridate::as_datetime(Inf)

as the output is NA.

However,

is.na(lubridate::as_datetime(Inf))

returns FALSE.

vspinu commented 2 years ago

This is how POSIXct objects are printed in R unfortunately. It's not lubridate specific:

> as.POSIXct(Inf)
[1] NA
> as.numeric(as.POSIXct(Inf))
[1] Inf

I am pretty sure we don't want to overwrite the default printing method in lubridate. Feel free to report this to R bug tracker proper.