Documentation / @interstellar-tools/temporal / NORMALIZE_TEMPORAL_UNIT
Variable: NORMALIZE_TEMPORAL_UNIT
ts
const NORMALIZE_TEMPORAL_UNIT: Readonly<{
as: 'as';
d: 'd';
day: 'd';
days: 'd';
fs: 'fs';
Ga: 'Gyr';
gigaannum: 'Gyr';
gigaannums: 'Gyr';
gigayear: 'Gyr';
gigayears: 'Gyr';
Gyr: 'Gyr';
h: 'h';
hour: 'h';
hours: 'h';
kiloyear: 'kyr';
kiloyears: 'kyr';
kyr: 'kyr';
Ma: 'Myr';
megaannum: 'Myr';
megaannums: 'Myr';
megayear: 'Myr';
megayears: 'Myr';
microsecond: 'μs';
microseconds: 'μs';
millisecond: 'ms';
milliseconds: 'ms';
min: 'min';
minute: 'min';
minutes: 'min';
ms: 'ms';
Myr: 'Myr';
ns: 'ns';
ps: 'ps';
s: 's';
second: 's';
seconds: 's';
us: 'μs';
year: 'yr';
years: 'yr';
yr: 'yr';
yrs: 'yr';
ys: 'ys';
zs: 'zs';
μs: 'μs';
}>;Defined in: normalize-temporal-unit.ts:33
Lookup table that normalizes user-facing time unit aliases (and the canonical symbols themselves) to a single, canonical TemporalUnitType.
Purpose
- Centralizes all string → symbol normalization (e.g.,
"seconds"→"s","us"→"μs"). - Ensures downstream math uses only canonical units (
s,ms,μs,min,h,d,yr,kyr,Myr,Gyr).
Conventions & semantics
- Durations only (no timestamp/"ago" meaning). Geology-style tokens (
Ma,Ga,megaannum,gigaannum) are treated as durations and normalized toMyr/Gyr. - Day is SI day: exactly 86 400 s.
- Year family (
yr,kyr,Myr,Gyr) is the Julian year convention: 365.25 d = 31 557 600 s. - Case-sensitive and exact matching. The ASCII alias
"us"is accepted and normalized to the Unicodeμs.
Usage pattern
- Accept
TemporalUnitAliasType | TemporalUnitTypeat your boundaries. - Normalize with this map.
- Store/compute exclusively with canonical TemporalUnitType.
The table is frozen: it can be read, but not changed at runtime.
See
- https://www.bipm.org/en/publications/si-brochure (SI Brochure - second & day)
- https://en.wikipedia.org/wiki/Julian_year\_(astronomy) (Julian year for yr/kyr/Myr/Gyr)