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

Add `sticky_units = FALSE` argument to parsers to parse only separated units in dates #1077

Open vspinu opened 1 year ago

vspinu commented 1 year ago

Because parsing in lubridate is too permissive it often creates undesired results when years are parsed as month-day or similar.

> mdy("June 2013")
[1] "2013-06-20"
> mdy("June 2013", sticky_units = FALSE)
[1] NA

alternative names for the new parameter stiky, allow_sticky, touching_units. glued_units.

vspinu commented 1 year ago

We probably should make this argument FALSE by default. Not backward compatible but this issue is a real pain.