Skip to content

@magmacomputing/tempo


parse(value, options?): ZonedDateTime

Defined in: discrete/discrete.parse.ts:546

Standalone Parser Returns a Temporal.ZonedDateTime from a variety of inputs.

Parameters

value

DateTime

options?

calendar?

CalendarLike

Temporal calendar

catch?

boolean

catch or throw Errors

debug?

number | boolean

additional console.log for tracking

discovery?

string | symbol

globalThis Discovery Symbol

event?

Extend<{ christmas: "25 Dec"; christmas ?eve: "24 Dec"; fortnight: (this) => Tempo; new.?years? ?eve: "31 Dec"; new.?years?( ?day)?: "01 Jan"; now: (this) => ZonedDateTime; ny: "01 Jan"; nye: "31 Dec"; today: (this) => ZonedDateTime; tomorrow: (this) => Tempo; xmas: "25 Dec"; xmas ?eve: "24 Dec"; yesterday: (this) => Tempo; }, string, string | Function> | PatternOption<Logic>

custom date aliases (events).

formats?

Property<any>

custom format strings to merge in the FORMAT enum

ignore?

Ignore

noise words to ignore during parsing.

layout?

Extend<{[key: symbol]: string; }, symbol, string> | PatternOption<Pattern>

patterns to help parse value

layoutOrder?

string[]

preferred parse-order of layouts

locale?

string

locale (e.g. en-AU)

mdyLayouts?

Pair[]

swap parse-order of layouts

mdyLocales?

string | string[]

locale-names that prefer 'mm-dd-yy' date order

mode?

"auto" | "strict" | "defer"

initialization strategy ('auto'|'strict'|'defer')

period?

Extend<{ after[ -]?noon: "3:00pm"; evening: "18:00"; half[ -]?hour: (this) => string; mid[ -]?day: "12:00"; mid[ -]?morning: "10:00"; mid[ -]?night: "24:00"; morning: "8:00"; night: "20:00"; noon: "12:00"; }, string, string | Function> | PatternOption<Logic>

custom time aliases (periods).

pivot?

number

pivot year for two-digit years

plugins?

Plugin | Plugin[]

plugins to be automatically extended

rtfFormat?

RelativeTimeFormat

Pre-configured relative time formatter

rtfStyle?

RelativeTimeFormatStyle

Default style for relative time ('long' | 'short' | 'narrow')

silent?

boolean

suppress console output during catch

snippet?

Extend<{[key: symbol]: RegExp; }, symbol, RegExp> | PatternOption<Pattern>

date-time snippets to help compose a Layout

sphere?

string

hemisphere for term.qtr or term.szn

store?

string

localStorage key

timeStamp?

TimeStamp

Precision to measure timestamps (ms | us)

timeZone?

TimeZoneLike

Temporal timeZone

value?

DateTime

supplied value to parse

Returns

ZonedDateTime

Example

ts
import { parse } from '@magmacomputing/tempo/parse';
const zdt = parse('2026-04-22');

Released under the MIT License.