Skip to content

isLeapYear

isLeapYear(value: string): boolean
import { 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.
Parameter Type Description
value string ISO PlainDate string

boolean indicating whether the date is in a leap year

isLeapYear("2024-03-15") // true
isLeapYear("2023-03-15") // false
isLeapYear("invalid") // false

plain/validate/isLeapYear.ts