R/find_closest_year.R
find_closest_year.Rd
This function takes a date as input and returns the closest year.
find_closest_year(date)
[character(1)] The date in format "YYYY-MM-DD".
character(1)
"YYYY-MM-DD"
An integer, the closest year to the input date.
integer
Other date helpers: check_date()
check_date()
find_closest_year(as.Date("2022-07-15")) #> [1] 2023 find_closest_year(as.Date("2022-01-01")) #> [1] 2022