Skip to content

isLeapSecond

isLeapSecond(value: string): boolean
import { isLeapSecond } from "@northguild/gmt/plain/validate";

Return true if the provided string is a valid ISO 8601 leap second datetime.

  • Validates leap second format using regex: “YYYY-MM-DDT23:59:60Z” or “YYYY-MM-DDT23:59:60+00:00”.
  • Accepts optional fractional seconds.
Parameter Type Description
value string ISO datetime string

boolean indicating whether the input string is a valid leap second datetime

isLeapSecond("2024-12-31T23:59:60Z") // true
isLeapSecond("2024-12-31T23:59:60.123Z") // true
isLeapSecond("2024-12-31T23:59:60+00:00") // true
isLeapSecond("2024-12-31T23:59:60.123+00:00") // true
isLeapSecond("2024-12-31T23:59:59Z") // false

plain/validate/isLeapSecond.ts