Skip to content

areDateTimesEqual

areDateTimesEqual(value1: string, value2: string): boolean
import { areDateTimesEqual } from "@northguild/gmt/plain/compare";

Return true if two PlainDateTime ISO strings represent the same instant of local date/time components.

  • Compares all date and time components.
  • Returns false if either input is invalid.
Parameter Type Description
value1 string first ISO PlainDateTime string
value2 string second ISO PlainDateTime string

boolean indicating whether both date-times are equal component-wise

areDateTimesEqual("2024-02-29T12:34:56", "2024-02-29T12:34:56") // true
areDateTimesEqual("2024-02-29T12:34:56", "2024-02-29T12:34:57") // false
areDateTimesEqual("2024-02-29T12:34:56", "invalid") // false

plain/compare/areDateTimesEqual.ts