is_valid_date_str: Test whether a string is a valid date
Description
Taken from github.com/rmsharp/rmsutilityr
Usage
is_valid_date_str(
date_str,
format = "%d-%m-%Y %H:%M:%S",
optional = FALSE
)
Value
A logical vector with one element per element of date_str
(zero-length input gives a zero-length result) indicating whether or not
each string is a valid date. Elements are NA instead of
FALSE when optional is TRUE. Numeric input is never
treated as a date and always gives FALSE.
Arguments
date_str
character vector with 0 or more dates
format
character vector of length one. Retained for backward
compatibility; the current implementation validates dates with
anytime() and does not use format.
optional
logical value indicating that NA should be returned
instead of FALSE for strings that are not valid dates.
Defaults to FALSE.