Skip to content

Choosing the public API

Choose the smallest public API that matches the temporal value you actually have. Atemporal's callable factory is a convenient compatibility facade; strict parsing makes a policy decision at data boundaries.

CasePublic APITimezone ruleFailure result
Event instantatemporal.parse with an offset-bearing ISO stringNever invent a zoneInvalidDateError or null
Scheduled eventatemporal.parse(input, { timeZone })Explicit IANA zone required for local inputReject DST ambiguity by default
Local civil date-timeatemporal.parseExplicit IANA zone requiredInvalidDateError or null
Date-only valueatemporal.parseUse the business zone only if a time will be addedInvalidDateError or null
Trusted boundary parsingatemporal.parseExplicit zone for local inputThrows InvalidDateError
Compatibility parsingatemporal(input)Optional zone; preserves compatibility behaviorInvalid wrapper
Formattingvalue.format(pattern)Format in the value zone or convert with .timeZone()Throws for invalid wrapper
Durationatemporal.duration(like)No zoneTemporal conversion error
Rangevalue.range(...)Keep both ends in an explicit, known zoneInvalid wrapper/error
Official pluginatemporal.extend(plugin) or lazyLoad(name)No zonePlugin load error
Third-party extensionatemporal.extend(markAsPlugin(...))No zoneExtension error

Use atemporal.tryParse instead of catching errors only when null is the correct result for malformed input. A DST policy is still required: its default is disambiguation: "reject".