Constructors
Constructor
new Tempo(options?): Tempo;Instantiates a new Tempo object with configuration only.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | Options | Configuration options for this specific instance. |
Returns
Tempo
Constructor
new Tempo(tempo, options?): Tempo;Instantiates a new Tempo object with a value.
Parameters
| Parameter | Type | Description |
|---|---|---|
tempo | DateTime | The date-time value to parse. |
options? | Options | Configuration options for this specific instance. |
Returns
Tempo
Properties
[$Identity]
static [$Identity]: boolean = true;allow instanceof to work across module boundaries via the local brand symbol
[$IsBase]
static [$IsBase]: boolean = true;Accessors
[toStringTag]
Get Signature
get toStringTag: string;Returns
string
cal
Get Signature
get cal(): string;Temporal Calendar ID (e.g., 'iso8601' | 'gregory')
Returns
string
config
Get Signature
get config(): Config;current Tempo configuration
Returns
Config
day
Get Signature
get day(): number;Day of the month (alias for dd)
Returns
number
dd
Get Signature
get dd(): number;Day of the month (1-31)
Returns
number
dow
Get Signature
get dow(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;iso weekday number: Mon=1, Sun=7
Returns
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
epoch
Get Signature
get epoch(): {
ms: number;
ns: bigint;
ss: number;
us: number;
};units since epoch
Returns
ms
readonly ms: number;milliseconds since epoch
ns
readonly ns: bigint;nanoseconds since epoch
ss
readonly ss: number;seconds since epoch
us
readonly us: number;microseconds since epoch
ff
Get Signature
get ff(): number;Fractional seconds (e.g., 0.123456789)
Returns
number
fmt
Get Signature
get fmt(): any;Formatted results for all pre-defined format codes
Returns
any
hh
Get Signature
get hh(): hh;Hour of the day (0-23)
Returns
hh
iso
Get Signature
get iso(): string;Standard ISO 8601 string in UTC
Returns
string
isValid
Get Signature
get isValid(): boolean | ZonedDateTime;true if the underlying date-time is valid.
Returns
boolean | ZonedDateTime
mi
Get Signature
get mi(): mi;Minutes of the hour (0-59)
Returns
mi
mm
Get Signature
get mm(): mm;Month number: Jan=1, Dec=12
Returns
mm
mmm
Get Signature
get mmm():
| "All"
| "Jan"
| "Feb"
| "Mar"
| "Apr"
| "May"
| "Jun"
| "Jul"
| "Aug"
| "Sep"
| "Oct"
| "Nov"
| "Dec";Short month name (e.g., 'Jan')
Returns
| "All" | "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
mon
Get Signature
get mon():
| "May"
| "Every"
| "January"
| "February"
| "March"
| "April"
| "June"
| "July"
| "August"
| "September"
| "October"
| "November"
| "December";Full month name (e.g., 'January')
Returns
| "May" | "Every" | "January" | "February" | "March" | "April" | "June" | "July" | "August" | "September" | "October" | "November" | "December"
ms
Get Signature
get ms(): ms;Milliseconds of the second (0-999)
Returns
ms
nano
Get Signature
get nano(): bigint;Nanoseconds since Unix epoch (BigInt)
Returns
bigint
ns
Get Signature
get ns(): ns;Nanoseconds of the microsecond (0-999)
Returns
ns
parse
Get Signature
get parse(): Parse;Instance-specific parse rules (merged with global)
Returns
Parse
ranges
Get Signature
get ranges(): Record<string, string>;current range key for every registered term
Returns
Record<string, string>
ss
Get Signature
get ss(): ss;Seconds of the minute (0-59)
Returns
ss
term
Get Signature
get term(): TempoTermRegistry;Keyed results for all resolved terms
Returns
terms
Get Signature
get terms(): Record<string, string[]>;list of registered terms and their available range keys
Returns
Record<string, string[]>
ts
Get Signature
get ts(): number | bigint;Unix timestamp (defaults to milliseconds)
Returns
number | bigint
tz
Get Signature
get tz(): string;IANA Time Zone ID (e.g., 'Australia/Sydney')
Returns
string
us
Get Signature
get us(): us;Microseconds of the millisecond (0-999)
Returns
us
wkd
Get Signature
get wkd():
| "Everyday"
| "Monday"
| "Tuesday"
| "Wednesday"
| "Thursday"
| "Friday"
| "Saturday"
| "Sunday";Full weekday name (e.g., 'Monday')
Returns
| "Everyday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"
ww
Get Signature
get ww(): wy;Deprecated
use wy
Returns
wy
www
Get Signature
get www(): "All" | "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun";Short weekday name (e.g., 'Mon')
Returns
"All" | "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
wy
Get Signature
get wy(): wy;iso week number of the year
Returns
wy
yw
Get Signature
get yw(): number;4-digit iso week-numbering year
Returns
number
yy
Get Signature
get yy(): number;4-digit year (e.g., 2024)
Returns
number
[$guard]
Get Signature
get static $guard: any;Master Guard predicate (implements RegExp-like interface)
Returns
any
$ImmutableSkip
Get Signature
get static $ImmutableSkip(): string[];Returns
string[]
config
Get Signature
get static config(): any;global Tempo configuration
Returns
any
default
Get Signature
get static default(): Readonly<{
calendar?: CalendarLike;
catch?: boolean;
debug?: DebugLevel;
discovery?: string | symbol | Discovery;
intl?: IntlOptions;
license?: string;
locale?: string | string[];
mode?: "auto" | "strict" | "defer";
monthDay?: boolean | MonthDay;
pivot?: number;
planner?: PlannerOptions;
plugins?: TempoPlugin | TermPlugin | (TempoPlugin | TermPlugin)[];
registry?: {
events?: | Extend<{
christmas: "25 Dec";
christmas ?eve: "24 Dec";
fortnight: (this) => AliasContext;
new.?years? ?eve: "31 Dec";
new.?years?(?: ?day)?: "01 Jan";
now: (this) => AliasContext;
ny: "01 Jan";
nye: "31 Dec";
today: (this) => ZonedDateTime;
tomorrow: (this) => AliasContext;
xmas: "25 Dec";
xmas ?eve: "24 Dec";
yesterday: (this) => AliasContext;
}, string, string | Function>
| RegistryOption<Logic>;
formats?: Property<any>;
ignores?: Ignore;
layouts?: | Extend<{
[key: symbol]: string;
}, symbol, string>
| RegistryOption<Pattern>;
locales?: Record<string, Record<string, string | Function>>;
modifiers?: Record<string, string | string[]>;
periods?: | 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>
| RegistryOption<Logic>;
snippets?: | Extend<{
[key: symbol]: RegExp;
}, symbol, RegExp>
| RegistryOption<Pattern>;
tokens?: Record<string, TokenEvaluator>;
};
scope: "default";
silent?: boolean;
sphere?: string;
store?: string;
timeStamp?: TimeStamp;
timeZone: TimeZoneLike;
value?: DateTime;
}>;Tempo initial default settings
Returns
Readonly<{ calendar?: CalendarLike; catch?: boolean; debug?: DebugLevel; discovery?: string | symbol | Discovery; intl?: IntlOptions; license?: string; locale?: string | string[]; mode?: "auto" | "strict" | "defer"; monthDay?: boolean | MonthDay; pivot?: number; planner?: PlannerOptions; plugins?: TempoPlugin | TermPlugin | (TempoPlugin | TermPlugin)[]; registry?: { events?: | Extend<{ christmas: "25 Dec"; christmas ?eve: "24 Dec"; fortnight: (this) => AliasContext; new.?years? ?eve: "31 Dec"; new.?years?(?: ?day)?: "01 Jan"; now: (this) => AliasContext; ny: "01 Jan"; nye: "31 Dec"; today: (this) => ZonedDateTime; tomorrow: (this) => AliasContext; xmas: "25 Dec"; xmas ?eve: "24 Dec"; yesterday: (this) => AliasContext; }, string, string | Function> | RegistryOption<Logic>; formats?: Property<any>; ignores?: Ignore; layouts?: | Extend<{ [key: symbol]: string; }, symbol, string> | RegistryOption<Pattern>; locales?: Record<string, Record<string, string | Function>>; modifiers?: Record<string, string | string[]>; periods?: | 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> | RegistryOption<Logic>; snippets?: | Extend<{ [key: symbol]: RegExp; }, symbol, RegExp> | RegistryOption<Pattern>; tokens?: Record<string, TokenEvaluator>; }; scope: "default"; silent?: boolean; sphere?: string; store?: string; timeStamp?: TimeStamp; timeZone: TimeZoneLike; value?: DateTime; }>
discovery
Get Signature
get static discovery(): any;global discovery configuration
Returns
any
FORMAT
Get Signature
get static FORMAT(): Extend<EnumifyType<{
date: "{yyyy}-{mm}-{dd}";
dayDate: "{dd}-{mmm}-{yyyy}";
dayMonth: "{dd}-{mmm}";
dayTime: "{dd}-{mmm}-{yyyy} {hh}:{mi}:{ss}";
display: "{www}, {dd} {mmm} {yyyy}";
logStamp: "{ymd}T{hms}.{ff}";
sortTime: "{yyyy}-{mm}-{dd} {hh}:{mi}:{ss}";
time: "{hh}:{mi}:{ss}";
weekDate: "{www}, {yyyy}-{mmm}-{dd}";
weekStamp: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}.{ff}";
weekTime: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}";
yearMonth: "{yyyy}{mm}";
yearMonthDay: "{ymd}";
yearWeek: "{yw}{wy}";
}>, string, string | number>;Pre-configured format {name -> string} pairs
Returns
Extend<EnumifyType<{ date: "{yyyy}-{mm}-{dd}"; dayDate: "{dd}-{mmm}-{yyyy}"; dayMonth: "{dd}-{mmm}"; dayTime: "{dd}-{mmm}-{yyyy} {hh}:{mi}:{ss}"; display: "{www}, {dd} {mmm} {yyyy}"; logStamp: "{ymd}T{hms}.{ff}"; sortTime: "{yyyy}-{mm}-{dd} {hh}:{mi}:{ss}"; time: "{hh}:{mi}:{ss}"; weekDate: "{www}, {yyyy}-{mmm}-{dd}"; weekStamp: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}.{ff}"; weekTime: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}"; yearMonth: "{yyyy}{mm}"; yearMonthDay: "{ymd}"; yearWeek: "{yw}{wy}"; }>, string, string | number>
formats
Get Signature
get static formats():
| Extend<EnumifyType<{
date: "{yyyy}-{mm}-{dd}";
dayDate: "{dd}-{mmm}-{yyyy}";
dayMonth: "{dd}-{mmm}";
dayTime: "{dd}-{mmm}-{yyyy} {hh}:{mi}:{ss}";
display: "{www}, {dd} {mmm} {yyyy}";
logStamp: "{ymd}T{hms}.{ff}";
sortTime: "{yyyy}-{mm}-{dd} {hh}:{mi}:{ss}";
time: "{hh}:{mi}:{ss}";
weekDate: "{www}, {yyyy}-{mmm}-{dd}";
weekStamp: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}.{ff}";
weekTime: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}";
yearMonth: "{yyyy}{mm}";
yearMonthDay: "{ymd}";
yearWeek: "{yw}{wy}";
}>, string, string | number>
| EnumifyType<any>;Deprecated
Use Tempo.registry.formats instead
Returns
| Extend<EnumifyType<{ date: "{yyyy}-{mm}-{dd}"; dayDate: "{dd}-{mmm}-{yyyy}"; dayMonth: "{dd}-{mmm}"; dayTime: "{dd}-{mmm}-{yyyy} {hh}:{mi}:{ss}"; display: "{www}, {dd} {mmm} {yyyy}"; logStamp: "{ymd}T{hms}.{ff}"; sortTime: "{yyyy}-{mm}-{dd} {hh}:{mi}:{ss}"; time: "{hh}:{mi}:{ss}"; weekDate: "{www}, {yyyy}-{mmm}-{dd}"; weekStamp: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}.{ff}"; weekTime: "{www}, {yyyy}-{mmm}-{dd} {hh}:{mi}:{ss}"; yearMonth: "{yyyy}{mm}"; yearMonthDay: "{ymd}"; yearWeek: "{yw}{wy}"; }>, string, string | number> | EnumifyType<any>
ignores
Get Signature
get static ignores(): Secure<Ignore>;static Tempo.ignores (registry)
Returns
Secure<Ignore>
instant
Get Signature
get static instant(): Instant;get the current system Instant
Returns
Instant
license
Get Signature
get static license(): {
audience?: string;
error?: string;
expires?: any;
issuedAt?: any;
issuer?: string;
jti?: string;
scopes: {
[k: string]: any;
};
status: string;
subject?: string;
};human-readable formatted license state
Returns
{
audience?: string;
error?: string;
expires?: any;
issuedAt?: any;
issuer?: string;
jti?: string;
scopes: {
[k: string]: any;
};
status: string;
subject?: string;
}audience?
readonly optional audience?: string;error?
readonly optional error?: string;expires?
readonly optional expires?: any;issuedAt?
optional issuedAt?: any;issuer?
readonly optional issuer?: string;jti?
readonly optional jti?: string;scopes
scopes: {
[k: string]: any;
};Index Signature
[k: string]: anystatus
readonly status: string;subject?
readonly optional subject?: string;LIMIT
Get Signature
get static LIMIT(): {
get maxTempo(): bigint;
get minTempo(): bigint;
};some useful Dates
Returns
maxTempo
Get Signature
get maxTempo(): bigint;Tempo(31-Dec-9999.23:59:59).ns
Returns
bigint
minTempo
Get Signature
get minTempo(): bigint;Tempo(01-Jan-1000.00:00:00).ns
Returns
bigint
MODE
Get Signature
get static MODE(): EnumifyType<{
Auto: "auto";
Defer: "defer";
Strict: "strict";
}>;initialization strategies
Returns
EnumifyType<{ Auto: "auto"; Defer: "defer"; Strict: "strict"; }>
MONTH_DAY
Get Signature
get static MONTH_DAY(): {
layouts: readonly [readonly ["dayMonthYearShort", "monthDayYearShort"], readonly ["dayMonthYear", "monthDayYear"]];
locales: readonly ["en-US", "en-AS"];
timezones: {
en-AS: readonly ["Pacific/Pago_Pago"];
en-US: readonly ["America/Adak", "America/Anchorage", "America/Boise", "America/Chicago", "America/Denver", "America/Detroit", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Los_Angeles", "America/Louisville", "America/Menominee", "America/Metlakatla", "America/New_York", "America/Nome", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Phoenix", "America/Sitka", "America/Yakutat", "Pacific/Honolulu", "US/Aleutian", "US/Alaska", "US/Arizona", "US/Central", "US/Eastern", "US/Mountain", "US/Pacific"];
};
};regional date-parsing configuration
Returns
{
layouts: readonly [readonly ["dayMonthYearShort", "monthDayYearShort"], readonly ["dayMonthYear", "monthDayYear"]];
locales: readonly ["en-US", "en-AS"];
timezones: {
en-AS: readonly ["Pacific/Pago_Pago"];
en-US: readonly ["America/Adak", "America/Anchorage", "America/Boise", "America/Chicago", "America/Denver", "America/Detroit", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Los_Angeles", "America/Louisville", "America/Menominee", "America/Metlakatla", "America/New_York", "America/Nome", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Phoenix", "America/Sitka", "America/Yakutat", "Pacific/Honolulu", "US/Aleutian", "US/Alaska", "US/Arizona", "US/Central", "US/Eastern", "US/Mountain", "US/Pacific"];
};
}layouts
readonly layouts: readonly [readonly ["dayMonthYearShort", "monthDayYearShort"], readonly ["dayMonthYear", "monthDayYear"]];locales
readonly locales: readonly ["en-US", "en-AS"];timezones
readonly timezones: {
en-AS: readonly ["Pacific/Pago_Pago"];
en-US: readonly ["America/Adak", "America/Anchorage", "America/Boise", "America/Chicago", "America/Denver", "America/Detroit", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Los_Angeles", "America/Louisville", "America/Menominee", "America/Metlakatla", "America/New_York", "America/Nome", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Phoenix", "America/Sitka", "America/Yakutat", "Pacific/Honolulu", "US/Aleutian", "US/Alaska", "US/Arizona", "US/Central", "US/Eastern", "US/Mountain", "US/Pacific"];
};timezones.en-AS
readonly en-AS: readonly ["Pacific/Pago_Pago"];timezones.en-US
readonly en-US: readonly ["America/Adak", "America/Anchorage", "America/Boise", "America/Chicago", "America/Denver", "America/Detroit", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Los_Angeles", "America/Louisville", "America/Menominee", "America/Metlakatla", "America/New_York", "America/Nome", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Phoenix", "America/Sitka", "America/Yakutat", "Pacific/Honolulu", "US/Aleutian", "US/Alaska", "US/Arizona", "US/Central", "US/Eastern", "US/Mountain", "US/Pacific"];NUMBER
Get Signature
get static NUMBER(): Extend<EnumifyType<{
eight: 8;
five: 5;
four: 4;
nine: 9;
one: 1;
seven: 7;
six: 6;
ten: 10;
three: 3;
two: 2;
zero: 0;
}>, string, number>;Number names (0-10)
Returns
Extend<EnumifyType<{ eight: 8; five: 5; four: 4; nine: 9; one: 1; seven: 7; six: 6; ten: 10; three: 3; two: 2; zero: 0; }>, string, number>
options
Get Signature
get static options(): any;Returns
any
parse
Get Signature
get static parse(): {
anchor?: ZonedDateTime;
event: {
[key: string]: string | Function;
christmas: "25 Dec";
christmas ?eve: "24 Dec";
fortnight: (this) => AliasContext;
new.?years? ?eve: "31 Dec";
new.?years?(?: ?day)?: "01 Jan";
now: (this) => AliasContext;
ny: "01 Jan";
nye: "31 Dec";
today: (this) => ZonedDateTime;
tomorrow: (this) => AliasContext;
xmas: "25 Dec";
xmas ?eve: "24 Dec";
yesterday: (this) => AliasContext;
};
ignore: {
[key: string]: string;
};
isAnchored?: boolean;
layout: {
[key: symbol]: string;
};
mode: "auto" | "strict" | "defer";
monthDay: MonthDay;
pattern: Registry;
period: {
[key: string]: string | Function;
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";
};
pivot: number;
planner: {
layoutOrder: (string | symbol)[];
preFilter: boolean;
};
result: Match[];
snippet: {
[key: symbol]: RegExp;
};
token: Extend;
};configuration governing the static 'rules' used when parsing t.DateTime argument
Returns
anchor?
readonly optional anchor?: ZonedDateTime;anchor value used for this parse operation
event
readonly event: {
[key: string]: string | Function;
christmas: "25 Dec";
christmas ?eve: "24 Dec";
fortnight: (this) => AliasContext;
new.?years? ?eve: "31 Dec";
new.?years?(?: ?day)?: "01 Jan";
now: (this) => AliasContext;
ny: "01 Jan";
nye: "31 Dec";
today: (this) => ZonedDateTime;
tomorrow: (this) => AliasContext;
xmas: "25 Dec";
xmas ?eve: "24 Dec";
yesterday: (this) => AliasContext;
};Index Signature
[key: string]: string | Functionevent.christmas
readonly christmas: "25 Dec" = '25 Dec';event.christmas ?eve
readonly christmas ?eve: "24 Dec" = '24 Dec';event.fortnight
readonly fortnight: (this) => AliasContext;Parameters
| Parameter | Type |
|---|---|
this | AliasContext |
Returns
AliasContext
event.new.?years? ?eve
readonly new.?years? ?eve: "31 Dec" = '31 Dec';event.new.?years?(?: ?day)?
readonly new.?years?(?: ?day)?: "01 Jan" = '01 Jan';event.now
readonly now: (this) => AliasContext;Parameters
| Parameter | Type |
|---|---|
this | AliasContext |
Returns
AliasContext
event.ny
readonly ny: "01 Jan" = '01 Jan';event.nye
readonly nye: "31 Dec" = '31 Dec';event.today
readonly today: (this) => ZonedDateTime;Parameters
| Parameter | Type |
|---|---|
this | AliasContext |
Returns
ZonedDateTime
event.tomorrow
readonly tomorrow: (this) => AliasContext;Parameters
| Parameter | Type |
|---|---|
this | AliasContext |
Returns
AliasContext
event.xmas
readonly xmas: "25 Dec" = '25 Dec';event.xmas ?eve
readonly xmas ?eve: "24 Dec" = '24 Dec';event.yesterday
readonly yesterday: (this) => AliasContext;Parameters
| Parameter | Type |
|---|---|
this | AliasContext |
Returns
AliasContext
ignore
readonly ignore: {
[key: string]: string;
};Index Signature
[key: string]: stringisAnchored?
readonly optional isAnchored?: boolean;was this a nested/anchored parse?
layout
readonly layout: {
[key: symbol]: string;
};Index Signature
[key: symbol]: stringmode
readonly mode: "auto" | "strict" | "defer";initialization strategy ('auto'|'strict'|'defer')
monthDay
readonly monthDay: MonthDay;pattern
readonly pattern: Registry;Map of regex-patterns to match input-string
period
readonly period: {
[key: string]: string | Function;
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";
};Index Signature
[key: string]: string | Functionperiod.after[ -]?noon
readonly after[ -]?noon: "3:00pm" = '3:00pm';period.evening
readonly evening: "18:00" = '18:00';period.half[ -]?hour
readonly half[ -]?hour: (this) => string;Parameters
| Parameter | Type |
|---|---|
this | AliasContext |
Returns
string
period.mid[ -]?day
readonly mid[ -]?day: "12:00" = '12:00';period.mid[ -]?morning
readonly mid[ -]?morning: "10:00" = '10:00';period.mid[ -]?night
readonly mid[ -]?night: "24:00" = '24:00';period.morning
readonly morning: "8:00" = '8:00';period.night
readonly night: "20:00" = '20:00';period.noon
readonly noon: "12:00" = '12:00';pivot
readonly pivot: number;pivot year for two-digit years
planner
planner: {
layoutOrder: (string | symbol)[];
preFilter: boolean;
};planner.layoutOrder
layoutOrder: (string | symbol)[];planner.preFilter
preFilter: boolean;result
readonly result: Match[];parsing match result
snippet
readonly snippet: {
[key: symbol]: RegExp;
};Index Signature
[key: symbol]: RegExptoken
readonly token: Extend;Symbol registry
properties
Get Signature
get static properties(): SecureArray<string>;static Tempo properties getter
Returns
SecureArray<string>
registry
Get Signature
get static registry(): any;static Tempo.registry
Returns
any
terms
Get Signature
get static terms(): SecureArray<PremiumPlugin> & Record<string, PremiumPlugin>;static Tempo.terms (registry)
Returns
SecureArray<PremiumPlugin> & Record<string, PremiumPlugin>
TIMEZONE
Get Signature
get static TIMEZONE(): Extend<{
acst: "Australia/Adelaide";
aest: "Australia/Sydney";
awst: "Australia/Perth";
cet: "Europe/Paris";
cst: "America/Chicago";
eet: "Europe/Helsinki";
est: "America/New_York";
gmt: "Europe/London";
ist: "Asia/Kolkata";
jst: "Asia/Tokyo";
mst: "America/Denver";
npt: "Asia/Kathmandu";
nzt: "Pacific/Auckland";
pst: "America/Los_Angeles";
utc: "UTC";
}, string, string>;TimeZone aliases
Returns
Extend<{ acst: "Australia/Adelaide"; aest: "Australia/Sydney"; awst: "Australia/Perth"; cet: "Europe/Paris"; cst: "America/Chicago"; eet: "Europe/Helsinki"; est: "America/New_York"; gmt: "Europe/London"; ist: "Asia/Kolkata"; jst: "Asia/Tokyo"; mst: "America/Denver"; npt: "Asia/Kathmandu"; nzt: "Pacific/Auckland"; pst: "America/Los_Angeles"; utc: "UTC"; }, string, string>
version
Get Signature
get static version(): string;the version of this Tempo build (stamped at build-time from package.json)
Returns
string
Methods
[iterator]()
iterator: ArrayIterator<EntryOf<any>>;iterate over instance formats
Returns
ArrayIterator<EntryOf<any>>
[toPrimitive]()
toPrimitive: string | number | bigint;allow for auto-convert of Tempo to BigInt, Number or String
Parameters
| Parameter | Type |
|---|---|
hint? | "string" | "number" | "default" |
Returns
string | number | bigint
add()
add(tempo?, options?): Tempo;returns a new Tempo with specific duration added.
Parameters
| Parameter | Type |
|---|---|
tempo? | MutateAdd |
options? | Options |
Returns
Tempo
clone()
clone(): Tempo;returns a clone of the current Tempo instance.
Returns
Tempo
format()
Call Signature
format<K>(fmt, options?): any;apply a custom format.
Type Parameters
| Type Parameter |
|---|
K extends Format |
Parameters
| Parameter | Type |
|---|---|
fmt | K |
options? | any |
Returns
any
Call Signature
format(options): string;applies a format to the instance.
Parameters
| Parameter | Type |
|---|---|
options | DateTimeFormatOptions & { calendar?: string; timeZone?: string; } |
Returns
string
Call Signature
format(fmt, options?): bigint;applies a format to the instance.
Parameters
| Parameter | Type |
|---|---|
fmt | "{nano}" |
options? | any |
Returns
bigint
Call Signature
format(fmt, options?): number;applies a format to the instance.
Parameters
| Parameter | Type |
|---|---|
fmt | | "{yw}{wy}" | "{yyyy}{mm}" | "{ymd}" | "{yyyy}{wy}" | "{yyyy}{mm}{dd}" | "{yywy}" | "{yw}" | "{ymd6}" | "{hms}" | "{ff}" | "{dmy}" | "{dmy6}" | "{mdy}" | "{mdy6}" |
options? | any |
Returns
number
Call Signature
format(fmt?, options?): any;applies a format to the instance.
Parameters
| Parameter | Type |
|---|---|
fmt? | any |
options? | any |
Returns
any
set()
set(tempo?, options?): Tempo;returns a new Tempo with specific offsets.
Parameters
| Parameter | Type |
|---|---|
tempo? | MutateSet |
options? | Options |
Returns
Tempo
setCatchMode()
setCatchMode(catchMode): this;explicitly enable/disable "catch" mode for this instance
Parameters
| Parameter | Type |
|---|---|
catchMode | boolean |
Returns
this
since()
Call Signature
since(arg0?, arg1?): any;time elapsed since another date-time
Parameters
| Parameter | Type |
|---|---|
arg0? | any |
arg1? | any |
Returns
any
Call Signature
since(until, opts?): string;time elapsed since (with unit)
Parameters
| Parameter | Type |
|---|---|
until | Until |
opts? | Options |
Returns
string
Call Signature
since(dateTimeOrOpts, until): string;time elapsed since another date-time (with unit)
Parameters
| Parameter | Type |
|---|---|
dateTimeOrOpts | Options | DateTime |
until | Until |
Returns
string
Call Signature
since(dateTimeOrOpts?, opts?): string;time elapsed since another date-time (w'out unit)
Parameters
| Parameter | Type |
|---|---|
dateTimeOrOpts? | Options | DateTime |
opts? | Options |
Returns
string
Call Signature
since(optsOrDate?, optsOrUntil?): string;time elapsed since another date-time
Parameters
| Parameter | Type |
|---|---|
optsOrDate? | any |
optsOrUntil? | any |
Returns
string
toDate()
toDate(): Date;the date-time as a standard Date object.
Returns
Date
toDateTime()
toDateTime(): ZonedDateTime;returns the underlying Temporal.ZonedDateTime
Returns
ZonedDateTime
toInstant()
toInstant(): Instant;returns the underlying Temporal.Instant
Returns
Instant
toJSON()
toJSON(): {
calendar: CalendarLike;
catch: boolean;
debug: DebugLevel;
discovery: string | symbol | Discovery;
intl: IntlOptions;
license?: string;
locale: string | string[];
mode: "auto" | "strict" | "defer";
plugins: TempoPlugin | TermPlugin | (TempoPlugin | TermPlugin)[];
registry: {
formats: EnumifyType;
locales: Record<string, Record<string, string | Function>>;
modifiers?: Record<string, string | string[]>;
tokens?: Record<string, TokenEvaluator>;
};
scope: "global" | "local";
silent: boolean;
sphere: string | undefined;
store: string;
timeStamp: TimeStamp;
timeZone: TimeZoneLike;
value: string;
};Custom JSON serialization for JSON.stringify.
Returns
calendar
calendar: CalendarLike;Temporal calendar
catch
catch: boolean;catch or throw Errors
debug
debug: DebugLevel;additional console.log for tracking
discovery
discovery: string | symbol | Discovery;globalThis Discovery Symbol
intl
intl: IntlOptions;internationalization configuration (relativeTime, etc.)
license?
optional license?: string;license key for premium features
locale
locale: string | string[];locale (e.g. en-AU)
mode
mode: "auto" | "strict" | "defer";initialization strategy ('auto'|'strict'|'defer')
plugins
plugins: TempoPlugin | TermPlugin | (TempoPlugin | TermPlugin)[];plugins to be automatically extended
registry
registry: {
formats: EnumifyType;
locales: Record<string, Record<string, string | Function>>;
modifiers?: Record<string, string | string[]>;
tokens?: Record<string, TokenEvaluator>;
};custom data augmentation registries
registry.formats
formats: EnumifyType;registry.locales
locales: Record<string, Record<string, string | Function>>;registry.modifiers?
optional modifiers?: Record<string, string | string[]>;registry.tokens?
optional tokens?: Record<string, TokenEvaluator>;scope
scope: "global" | "local";scope for configuration mutations
silent
silent: boolean;suppress console output during catch
sphere
sphere: string | undefined;hemisphere for term.qtr or term.szn
store
store: string;localStorage key
timeStamp
timeStamp: TimeStamp;Precision to measure timestamps (ms | us)
timeZone
timeZone: TimeZoneLike;Temporal timeZone
value
value: string;toNow()
toNow(): ZonedDateTime;the current system time localized to this instance.
Returns
ZonedDateTime
toPlainDate()
toPlainDate(): PlainDate;returns a Temporal.PlainDate representation
Returns
PlainDate
toPlainDateTime()
toPlainDateTime(): PlainDateTime;returns a Temporal.PlainDateTime representation
Returns
PlainDateTime
toPlainTime()
toPlainTime(): PlainTime;returns a Temporal.PlainTime representation
Returns
PlainTime
toString()
toString(): string;iso8601 string representation of the date-time.
Returns
string
until()
Call Signature
until(arg0?, arg1?): any;time duration until another date-time
Parameters
| Parameter | Type |
|---|---|
arg0? | any |
arg1? | any |
Returns
any
Call Signature
until(dateTimeOrOpts?, opts?): Duration;time duration until (returns Duration)
Parameters
| Parameter | Type |
|---|---|
dateTimeOrOpts? | Options | DateTime |
opts? | Options |
Returns
Duration
Call Signature
until(unit, opts?): number;time duration until (with unit, returns number)
Parameters
| Parameter | Type |
|---|---|
unit | Unit |
opts? | Options |
Returns
number
Call Signature
until(dateTimeOrOpts, unit): number;time duration until another date-time (with unit)
Parameters
| Parameter | Type |
|---|---|
dateTimeOrOpts | Options | DateTime |
unit | Unit |
Returns
number
Call Signature
until(optsOrDate?, optsOrUntil?): number | Duration;fallback: union of possible returns
Parameters
| Parameter | Type |
|---|---|
optsOrDate? | | string | number | bigint | TempoBrand | ZonedDateTime | Instant | Options | PlainDate | PlainDateTime | ZonedDateTimeLikeObject | ISOString | Date | Tempo | PlainTime | Duration | Options & { unit?: Unit; } | null |
optsOrUntil? | Options | Until |
Returns
number | Duration
[$buildGuard]()
static $buildGuard: void;Parameters
| Parameter | Type |
|---|---|
targetState? | State |
Returns
void
[$setAliases]()
static [$setAliases](
shape,
kind,
token,
provided?): void;{dt} is a layout that combines date-related {snippets} (e.g. dd, mm -or- evt) into a pattern against which a string can be tested.
because it will also include a list of events (e.g. 'new_years' | 'xmas'), we need to rebuild {dt} if the user adds a new event
Parameters
| Parameter | Type |
|---|---|
shape | State |
kind | "evt" | "per" |
token | any |
provided? | [string, any][] |
Returns
void
[$setConfig]()
static $setConfig: void;conform input of Snippet / Layout / Event / Period options
This is needed because we allow the user to flexibly provide detail as {[key]:val} or {[key]:val}[] or [key,val][]
Parameters
| Parameter | Type |
|---|---|
shape | State |
...options | Options[] |
Returns
void
[$setDiscovery]()
static $setDiscovery: Options;support "Global Discovery" of user-options
Parameters
| Parameter | Type |
|---|---|
shape | State |
discovery? | Discovery |
Returns
Options
[$setEvents]()
static [$setEvents](
shape,
provided?,
rebuild?): void;Parameters
| Parameter | Type | Default value |
|---|---|---|
shape | State | undefined |
provided? | [string, any][] | undefined |
rebuild? | boolean | true |
Returns
void
[$setPeriods]()
static [$setPeriods](
shape,
provided?,
rebuild?): void;Parameters
| Parameter | Type | Default value |
|---|---|---|
shape | State | undefined |
provided? | [string, any][] | undefined |
rebuild? | boolean | true |
Returns
void
[dispose]()
static dispose: void;release global config and reset library to defaults
Returns
void
[hasInstance]()
static hasInstance: boolean;Parameters
| Parameter | Type |
|---|---|
instance | any |
Returns
boolean
[iterator]()
static iterator: ArrayIterator<string>;iterate over Tempo properties
Returns
ArrayIterator<string>
bootstrap()
static bootstrap(options?): Promise<typeof Tempo>;Automatically discovers and loads configuration from tempo.config.* before initializing the engine.
Parameters
| Parameter | Type |
|---|---|
options? | { configFile?: string; cwd?: string; } |
options.configFile? | string |
options.cwd? | string |
Returns
Promise<typeof Tempo>
compare()
static compare(tempo1?, tempo2?): number;Compares two Tempo instances or date-time values. Returns -1 (earlier), 0 (equal), or 1 (later).
Parameters
| Parameter | Type |
|---|---|
tempo1? | Options | DateTime |
tempo2? | Options | DateTime |
Returns
number
create()
static create(options?): typeof Tempo;🏭 Sandbox Factory Mode Create a fresh, isolated Tempo subclass with its own configuration and registries. Returns a new class that inherits from the caller, but maintains independent state.
Parameters
| Parameter | Type |
|---|---|
options | Options |
Returns
typeof Tempo
extend()
Call Signature
static extend(plugin, options?): typeof Tempo;Register a plugin or term extension.
Parameters
| Parameter | Type | Description |
|---|---|---|
plugin | TempoPlugin | A plugin or term extension to register. |
options? | Options | Optional configuration for the plugin. |
Returns
typeof Tempo
Call Signature
static extend(plugins, options?): typeof Tempo;Register an array of plugins or term extensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
plugins | any[] | An array of plugins, terms, or extensions to register. |
options? | Options | Optional configuration for the plugins. |
Returns
typeof Tempo
Call Signature
static extend(...args): typeof Tempo;Register multiple plugins or term extensions.
Parameters
| Parameter | Type | Description |
|---|---|---|
...args | any[] | A plugin, term, or list of extensions to register. |
Returns
typeof Tempo
from()
Call Signature
static from(options?): Tempo;Creates a new Tempo instance.
Parameters
| Parameter | Type |
|---|---|
options? | Options |
Returns
Tempo
Call Signature
static from(tempo, options?): Tempo;Creates a new Tempo instance.
Parameters
| Parameter | Type |
|---|---|
tempo | DateTime |
options? | Options |
Returns
Tempo
init()
static init(options?): typeof Tempo;Reset Tempo to its default, built-in registration state
Parameters
| Parameter | Type |
|---|---|
options | Options |
Returns
typeof Tempo
isTempo()
static isTempo(instance?): instance is Tempo;check if a supplied variable is a valid Tempo instance
Parameters
| Parameter | Type |
|---|---|
instance? | any |
Returns
instance is Tempo
now()
static now(): bigint;Returns
bigint
ready()
static ready(): Promise<string>;Wait for the background licensing and validation engine to finish settling. Resolves immediately if no license key or validation is pending.
Returns
Promise<string>
The final, human-readable license status ('none', 'active', 'expired', etc.)
regexp()
static regexp(layout, snippet?): RegExp;translates {layout} into an anchored, case-insensitive RegExp.
Parameters
| Parameter | Type |
|---|---|
layout | string | RegExp |
snippet? | Extend<{ [key: symbol]: RegExp; }, symbol, RegExp> |
Returns
RegExp
setCatchMode()
static setCatchMode(catchMode): typeof Tempo;explicitly enable/disable "catch" mode for internal errors
Parameters
| Parameter | Type |
|---|---|
catchMode | boolean |
Returns
typeof Tempo