isLeapYear
Signature
Section titled “Signature”isLeapYear(value: string): booleanimport { isLeapYear } from "@northguild/gmt/plain/validate";Return true when the given PlainDate falls in a leap year.
- A leap year is divisible by 4, except for century years which must be divisible by 400.
- Returns false for invalid input strings.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO PlainDate string |
Returns
Section titled “Returns”boolean indicating whether the date is in a leap year
Examples
Section titled “Examples”isLeapYear("2024-03-15") // trueisLeapYear("2023-03-15") // falseisLeapYear("invalid") // false