Skip to content

isZonedPast

isZonedPast(value: string): boolean
import { isZonedPast } from "@northguild/gmt/zoned/compare";

Return true when value represents an instant strictly before now.

  • Unlike the plain isPast, which compares calendar days, this compares the exact instant value represents against Temporal.Now.instant()value carries a full time-of-day, not just a date.
  • value === now (to the precision available) returns false — “past” means strictly before, not on-or-before.
  • Returns false if value is invalid.
Parameter Type Description
value string ISO ZonedDateTime string

true if value is before the current instant, false on invalid input

isZonedPast("2020-01-01T00:00:00Z[UTC]") // true (an instant in the distant past)
isZonedPast("2999-01-01T00:00:00Z[UTC]") // false (an instant in the distant future)
isZonedPast("invalid") // false

zoned/compare/isZonedPast.ts