In Lubridate 1.9.0, supplying a custom format string to as_date raises an error if a character is not prefixed by a "%". In the reprex below, a standard YYYY-MM-DD date string works, but adding any additional characters to the string raises an error. The same date conversion works with base R's as.Date:
lubridate::as_date("test2022-01-01", format="test%Y-%m-%d")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'as_date': Unknown formats supplied: tet
lubridate::as_date("2022-01-01", format="%Y-%m-%d")
#> [1] "2022-01-01"
as.Date("test2022-01-01", format="test%Y-%m-%d")
#> [1] "2022-01-01"
In Lubridate 1.9.0, supplying a custom format string to
as_date
raises an error if a character is not prefixed by a "%". In thereprex
below, a standard YYYY-MM-DD date string works, but adding any additional characters to the string raises an error. The same date conversion works with base R'sas.Date
:Here is my session info:
Created on 2022-11-16 with reprex v2.0.2