shrektan / ymd

An R package that handles common dates operations using Rust
https://shrektan.github.io/ymd/
Other
33 stars 2 forks source link

junk after date #2

Closed ggrothendieck closed 2 years ago

ggrothendieck commented 2 years ago

You may or may not want to implement this but just wanted to point out that as.Date in base R and ymd in lubridate both ignore junk at the end if you don't supply a format.

as.Date("2000-01-02junk")
## [1] "2000-01-02"

library(ymd)
ymd("2000-01-02junk")
## [1] NA
shrektan commented 2 years ago

Thanks for the reminder. It's not difficult to implement but I decide not. The reasons are:

  1. Dates with junk suffix probably should be regarded as abnormal input, thus NA;
  2. It's better to keep the code as simple and minimal as possible.