isLeapYear
Signature
Section titled “Signature”isLeapYear(value: string): booleanReturn 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, including every shape
isValidDaterejects: a date-time, zoned, basic-format or leap-second string, or a non-ISO calendar annotation. The annotations Temporal ignores are accepted ("2024-06-15[u-ca=iso8601]"→ true). - Compatibility: earlier releases read those shapes loosely (
"2024-03-15T10:00"→true). Pass the date part alone, or useTemporal.PlainDate.from(value).inLeapYear.
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”import { isLeapYear } from "@northguild/gmt/plain/validate";
isLeapYear("2024-03-15") // true