isValidDate | R Documentation |
Function to test if an object is a valid date.
isValidDate(dt)
dt |
|
if is.na(as.Date(dt)) does not throw an error and is TRUE, then the function returns TRUE; otherwise, it returns FALSE.
Based on discussion at https://gist.github.com/micstr/69a64fbd0f5635094a53.
logical
isValidDate("2023-02-28"); #--expect TRUE
isValidDate("2023-02-30"); #--expect FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.