Check if a given year is leap (366 days) or not (365 days).

is_leap_year(x)

Arguments

x

numeric value or dates vector in the format YYYY-MM-DD.

Value

Boolean. TRUE if it is a leap year, FALSE otherwise.

Examples

is_leap_year("2024-02-01")
#> [1] TRUE
is_leap_year(c(2023:2030))
#> [1] FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE
is_leap_year(c("2024-10-01", "2025-10-01"))
#> [1]  TRUE FALSE
is_leap_year("2029-02-01")
#> [1] FALSE