Skip to main content

Type Alias: InvalidInstantReason

InvalidInstantReason = "unreadable" | "no-such-date" | "not-finite" | "null-value" | "zoneless"

Defined in: model/errors.ts:175

Why toInstant/instant refused a value — the closed set InvalidInstantError.reason takes, so a consumer branches on data instead of parsing the message (#242).

  • 'unreadable' — not a date this library reads at all: an unparseable string, a boolean, a plain object, an array. The catch-all for everything the other four reasons do not name.
  • 'no-such-date' — a calendar date the calendar does not have, such as '2026-02-31'.
  • 'not-finite' — a number that is not a finite count of epoch milliseconds (NaN, Infinity).
  • 'null-value' — null or undefined. Not a zone problem: an absent date is a value left out, not a null one (#431).
  • 'zoneless' — a real wall-clock reading with no zone attached, handed to instant(), which resolves no zone. Only instant() produces it — toInstant has a zone and resolves such a string instead of refusing it.