Skip to content

πŸ’₯ Migrating to Tempo v5.x ​

Tempo v5.x focuses on modern ECMAScript standards alignment, streamlined API ergonomics, removal of deprecated getters, static enums, legacy format tokens, and first-class integration with TC39 Signals across the reactive plugin ecosystem.


πŸ›‘ Deprecation Removals & Breaking Changes in v5.0.0 ​

1. Static Enum Accessors (Tempo.enums.*) ​

The top-level static enum accessors on Tempo have been removed in favor of the unified Tempo.enums namespace.

  • Removed: Tempo.ELEMENT, Tempo.FORMAT, Tempo.NUMBER, Tempo.ORDINAL, Tempo.TIMEZONE, Tempo.MONTH_DAY, Tempo.MODE, Tempo.CACHE, Tempo.LIMIT
  • Replacement: Use Tempo.enums.<NAME> (for example, Tempo.enums.FORMAT, Tempo.enums.MODE, Tempo.enums.TIMEZONE, Tempo.enums.ELEMENT).
typescript
// ❌ v4.x (Deprecated)
const formatEnum = Tempo.FORMAT;

// βœ… v5.0.0
const formatEnum = Tempo.enums.FORMAT;

2. Static Extension Method (Tempo.use) ​

The legacy static Tempo.extend(...) method has been removed.

  • Removed: Tempo.extend(...)
  • Replacement: Use Tempo.use(...) (or sandbox.use(...)).
typescript
// ❌ v4.x (Deprecated)
Tempo.extend(MyPlugin);

// βœ… v5.0.0
Tempo.use(MyPlugin);

3. Instance Properties and Getters ​

Several legacy and ambiguous instance getters have been removed in favor of canonical ISO / temporal properties:

Removed GetterCanonical ReplacementDescription
t.eraYeart.eonYear within era (eon / astronomical era calendar alignment).
t.ww, t.wyt.woyWeek of year (ISO 8601 week number 1..53).
t.ywt.yow4-digit ISO week-numbering year.
t.dayt.ddDay of the month (1–31 number). Use t.format('{dd}') when zero-padded text is needed. For day-of-week use t.dow, and for day-of-year use t.doy.
t.nanot.epoch.nsHigh-precision nanoseconds since Unix epoch (bigint).
t.termsTempo.terms / t.term.<scope>.keysRegistered term definitions and available range keys (keys on static Tempo.terms.<key> or instance t.term.<scope>).
t.rangest.term.<key>Active range key for a specific term evaluated lazily on demand.
t.clone()Tempo.from(t, t.config)Canonical instance cloning constructor (preserves instance-local configuration).
typescript
// ❌ v4.x (Deprecated)
const week = t.ww; // or t.wy
const weekYear = t.yw;
const eraY = t.eraYear;
const dayVal = t.day;
const nanoVal = t.nano;
const copy = t.clone();

// βœ… v5.0.0
const week = t.woy;
const weekYear = t.yow;
const eraY = t.eon;
const dayVal = t.dd;
const nanoVal = t.epoch.ns;
const copy = Tempo.from(t, t.config);

NOTE

Humanized t.era & t.eon on iso8601: In v5.0.0, t.era ('ce' / 'bce') and t.eon (positive era year) always resolve even on the iso8601 calendar instead of returning undefined. If you need the raw TC39 Temporal behavior where iso8601 omits eras, access t.zdt.era and t.zdt.eraYear.


4. Static Tempo.now() Transition to Instance Factory ​

In v4.x, Tempo.now() returned a primitive timestamp (bigint nanoseconds by default, or number when passed a unit string). In v5.0.0, Tempo.now() is a full instance factory (matching modern standards like Luxon DateTime.now() and TC39 Temporal):

  • Tempo.now(options?) returns an immutable Tempo instance representing the current moment, supporting instance options like { timeZone, locale }.
  • Primitive timestamps are now cleanly accessed via the static Tempo.epoch namespace:
    • Tempo.epoch.ns (bigint) β€” nanoseconds since Unix epoch
    • Tempo.epoch.ms (number) β€” milliseconds since Unix epoch
    • Tempo.epoch.us (number) β€” microseconds since Unix epoch
    • Tempo.epoch.ss (number) β€” seconds since Unix epoch
  • Native Temporal Instant is accessible via Tempo.instant (Temporal.Instant).
typescript
// ❌ v4.x
const nowNs: bigint = Tempo.now();
const nowMs: number = Tempo.now('ms');

// βœ… v5.0.0 β€” Instance creation & fluent chaining
const now: Tempo = Tempo.now();
const today = Tempo.now().format('{yyyy}-{mm}-{dd}');
const tokyo = Tempo.now({ timeZone: 'Asia/Tokyo' });

// βœ… v5.0.0 β€” Primitive timestamps via Tempo.epoch
const nowNs: bigint = Tempo.epoch.ns;
const nowMs: number = Tempo.epoch.ms;
const inst: Temporal.Instant = Tempo.instant;

5. Format Tokens and Modifiers ​

To reduce token ambiguity and eliminate redundant aliases, format tokens and modifier definitions have been rationalized:

  • Timezone Token ({tzd} β†’ {tz}):
    • The legacy {tzd} (timezone delimiter / descriptor) token has been removed.
    • Use the canonical {tz} token instead.
  • Composite Week-Year Tokens ({yyww}, {yywy}, {yywoy}):
    • Composite week-and-year tokens have been removed in favor of composable standard tokens.
    • Replace {yywoy} or {yyww} with {yow}{woy} (or localized {yow:locale}{woy:locale}).
  • Week & Week-Year Token Aliases ({yw} β†’ {yow}, {wy} β†’ {woy}):
    • The legacy shorthand aliases {yw} (week-numbering year) and {wy} (week of year) have been removed.
    • Replace {yw} with {yow} (and {yw:locale} with {yow:locale}), and replace {wy} with {woy} (and {wy:locale} with {woy:locale}).
  • Calendar Week, Week of Month & Century Tokens ({ww}, {wom}, {cen} Removed):
    • {ww} has been removed in favor of {woy} (for ISO 8601 / Locale Week of Year: {woy} / {woy:locale}) and {woy:cal} (for Calendar Week of Year starting on January 1st, matching Oracle WW).
    • {wom} has been removed in favor of {woy:month} (week of month 1–5).
    • {cen} / {century} have been removed; compute century directly via String(Math.abs(Math.floor(t.yy / 100))).padStart(2, '0').
    • {julian} and {h24} aliases have been removed; use canonical {jj} and {hh} instead.
  • Year Modifier Aliases (:yy and :year):
    • The :yy and :year sub-modifier aliases on year tokens have been removed.
    • Use the canonical {yy} token (or {yyyy} for 4-digit years).
  • Legacy Offset Modifiers on {tz}:
    • Legacy modifier cases (offsetshort, offsetcompact, z, zz, zzz, zzzz, zzzzz) on {tz} have been removed from the core formatter.
    • Use canonical {tz:offset}, composable {tz:offset:compact}, {tz:short}, or {tz:long} in core ({tz:offset:compact} replaces legacy {tz:offsetcompact} and v4.7 {tz:zzz} for unpunctuated offsets like +0530), or load @tempo-kit/plugin-dialects if LDML / Moment-style pattern emulation is required.
  • Removed Legacy Getter Tokens ({day}, {nano}):
    • {day} (from removed t.day) and {nano} (from removed t.nano) have been removed.
    • Use {dd} or {dd:raw} in place of {day}. For {nano}, use {ts} with { timeStamp: 'ns' } (for example, format(zdt, '{ts}', { timeStamp: 'ns' }), which works for both Tempo and native Temporal values), or {epoch.ns} when formatting Tempo instances (standalone format(zdt, ...) on native Temporal values leaves {epoch.ns} literal).
typescript
// ❌ v4.x (Deprecated)
t.format('{tzd}');
t.format('{yywoy}');
t.format('{year:yy}');

// βœ… v5.0.0
t.format('{tz}');
t.format('{yow}{woy}');
t.format('{yy}');

6. Utility & Support Exports ​

  • Enum export removed: The legacy Enum class export from tempo-kit has been removed. Use native TypeScript enums, as const object literals, or the tempo-kit/library enumerator utilities (enumify).
  • hasOwn helper removed: The internal re-export hasOwn from support utils has been removed. Use standard ECMAScript Object.hasOwn(target, property).

7. Static Sandbox Factory Transition (Tempo.extend) ​

Note that the legacy v4 plugin-registration signature Tempo.extend(...) has been removed (see Section 2 aboveβ€”use Tempo.use(...) instead). To align with prototypical inheritance conventions across the monorepo (such as Enum.extend), the static sandbox factory method Tempo.create(...) has been transitioned to the reused Tempo.extend(...) name with a clean break:

  • Removed: Tempo.create(options?), Tempo.create(fn), Tempo.create(options, fn)
  • Replacement: Use Tempo.extend(options?), Tempo.extend(fn), Tempo.extend(options, fn)
typescript
// ❌ v4.x
const MyTempo = Tempo.create({ timeZone: 'UTC' });
const val = Tempo.create((sb) => sb.now());

// βœ… v5.0.0
const MyTempo = Tempo.extend({ timeZone: 'UTC' });
const val = Tempo.extend((sb) => sb.now());

8. Term Architecture: Civic vs. Cultural Terms, Quarter Split & .span Encapsulation ​

In v5.0.0, the Term system undergoes a breaking architectural refinement to align with international standards and provide clean, encapsulated range objects:

  • Opt-in Requirement for Cultural & Astrological Terms:
    • TermsModule now registers only standard CivicTerms (QuarterTerm, SeasonTerm, TimelineTerm) by default.
    • Cultural and astrological terms (ZodiacTerm, EasternTerm) have been extracted into the standalone @tempo-kit/plugin-cultural package, while corporate fiscal quarters (FiscalTerm) are opt-in via tempo-kit/terms.
    • Code relying on automatic t.term.zodiac or t.term.shengxiao registration will evaluate to undefined unless @tempo-kit/plugin-cultural is installed and registered.
  • QuarterTerm (qtr / quarter) strictly ISO 8601-2 aligned:
    • Calendar quarters strictly map to standard Gregorian calendar quarters (Q1 = Jan 1, Q2 = Apr 1, Q3 = Jul 1, Q4 = Oct 1) globally, completely decoupled from geographic hemisphere (sphere).
    • The legacy fiscal field on QuarterTerm scope has been removed.
  • Dedicated FiscalTerm (fqtr / fiscal) β€” Superseding @magmacomputing/tempo-plugin-finance:
    • Financial, corporate, and jurisdictional fiscal quarters have moved into the built-in FiscalTerm plugin (tempo-kit/terms), superseding the standalone @magmacomputing/tempo-plugin-finance package.
    • Standard range keys are 'FQ1', 'FQ2', 'FQ3', 'FQ4' (replacing numeric t.finance.fiscalQuarter 1..4).
    • Provides a direct numeric year: number (e.g. 2026, replacing t.finance.taxYear).
    • Supports configurable options { startMonth?: number, startDay?: number, country?: string } with automated jurisdictional defaults (including timeZone country inference) and resolved config metadata on t.term.fiscal.config.
    • Year-start detection (t.finance.isFiscalYearStart()) is replaced by f?.key === 'FQ1' && t.equals(f.span.start, 'day') using the new t.equals() / Tempo.equals() / Tempo.compare() APIs.
  • Encapsulated Range Metrics (.span):
    • Temporal boundaries (start, end) and duration progress metrics (total, elapsed, remaining, progress) are now encapsulated within span: TermSpan.
    • The legacy root-level getters (range.start, range.end) have been removed.
    • Leaked internal template schema matching units (year, month, week, day, hour, minute, etc.) are stripped from resolved root range objects.
  • SeasonTerm Equatorial Support:
    • SeasonTerm now supports sphere: 'equator', resolving tropical bimodal Wet and Dry seasons ('Long Wet', 'Long Dry', 'Short Wet', 'Short Dry').
typescript
// ❌ v4.x (Quarter was hemisphere-dependent; cultural terms auto-loaded; root start/end leaked)
const t4 = new Tempo('2026-02-15', { sphere: 'south' });
t4.term.qtr; // 'Q3' (in v4 southern hemisphere)
t4.term.quarter.start; // Root getter
t4.term.quarter.fiscal; // Legacy fiscal year string/number
t4.term.quarter.month; // Leaked template matching schema key
t4.term.zdc; // 'Aquarius' (cultural terms were auto-registered)
typescript
// βœ… v5.0.0 (Quarter is ISO 8601-2; boundaries and progress encapsulated in .span)
const t = new Tempo('2026-02-15', { sphere: 'south' });
t.term.qtr; // 'Q1' (strictly ISO 8601-2 calendar quarter everywhere)
t.term.quarter.span.start; // Frozen Tempo instance
t.term.quarter.span.end;   // Frozen Tempo instance
t.term.quarter.span.progress; // Normalized float (0.0 .. 1.0)

// βœ… v5.0.0 (Cultural & Astrological terms live in @tempo-kit/plugin-cultural)
import { CulturalPlugin, ZodiacTerm, EasternTerm } from '@tempo-kit/plugin-cultural';

// Option A: Register individual terms
Tempo.use(ZodiacTerm);
Tempo.use(EasternTerm);

// Option B: Register the full cultural plugin
Tempo.use(CulturalPlugin);

const tAstro = new Tempo('2026-02-15');
tAstro.term.zdc; // 'Aquarius'
tAstro.term.shengxiao.animal; // 'Horse'

// βœ… v5.0.0 (Fiscal cycles use FiscalTerm)
import { FiscalTerm } from 'tempo-kit/terms';
Tempo.use(FiscalTerm);

const tFiscal = new Tempo('2026-02-15', { pluginOptions: { fiscal: { country: 'AU' } } });
tFiscal.term.fqtr; // 'FQ3'
tFiscal.term.fiscal?.year; // 2026
tFiscal.term.fiscal?.span.start; // Tempo('2026-01-01T00:00:00')

⚠️ Migrating to Tempo v4.x ​

Tempo v4.x introduces a standardized plugin & registry architecture, strict configuration namespaces, cascading configuration inheritance, and deterministic resource disposal while excising legacy v3.x deprecated interfaces.

⚑ Dynamic Functional Context (DFC) & Supplier Options ​

In v4.0.0, core configuration options (timeZone, locale, calendar, sphere) accept lazy Evaluable<T> supplier functions (() => T) as well as static scalars. This enables dynamic, per-request context resolution (e.g. multi-tenant session headers, request-scoped localizations) without recreating Tempo options or rebuilding configuration objects.

typescript
// βœ… v4.0.0 - Dynamic per-request timezone resolution
import { Tempo } from 'tempo-kit';
import { getActiveTenantTimezone } from './session';

Tempo.init({
  timeZone: () => getActiveTenantTimezone(), // Re-evaluated dynamically when context getters execute
  locale: () => getCurrentUserLocale()
});

πŸ› οΈ Plugin SDK Subpath (tempo-kit/plugin/sdk) ​

In v4.0.0, all custom plugin, term, module, and namespace development is standardized on tempo-kit/plugin/sdk.

  • Legacy Imports: Deprecated plugin-api.index.ts and #tempo/license subpath imports have been removed.
  • SDK Import: Import definePlugin, defineTerm, defineModule, defineNamespace, defineRange, and evaluation utilities directly from tempo-kit/plugin/sdk.
typescript
// ❌ v3.x (Deprecated)
import { definePlugin } from 'tempo-kit/plugin-api';

// βœ… v4.0.0
import { definePlugin } from 'tempo-kit/plugin/sdk';

πŸ“„ Zero-await Synchronous JSONC Config Discovery ​

Tempo v4.0.0 introduces resolveConfigSync() for zero-await synchronous configuration discovery when using .json or .jsonc configuration files.

  • .json / .jsonc files: Dynamically discovered and parsed synchronously during module initialization via parseJSONC.
  • .ts / .mts / .mjs / .js files: Asynchronously loaded via resolveConfig().
  • Deprecated .cjs config discovery files are no longer automatically scanned.

πŸ”“ 100% Open-Source Community Core ​

Tempo v4.0.0 Community Core is 100% open-source without commercial license validation hooks or JWT scope checks.

  • License keys (licenseKey, TEMPO_LICENSE_KEY) are no longer required or checked in the Community Edition.
  • Tempo.ready() returns 'none' for community core compatibility.

πŸš€ Tempo v4.1.0 Updates ​

Tempo v4.1.0 introduces cascading configuration inheritance (extends), a dedicated pluginOptions configuration slot, and overloaded Tempo.create() with deterministic resource cleanup (TC39 using).

πŸ”Œ Configuration Inheritance (extends), plugins, and pluginOptions ​

In v4.1.0, configuration, plugin registration, and runtime options have been cleanly separated:

  • Configuration Inheritance (extends): The extends option in Tempo.init() or tempo.config.json is strictly reserved for cascading configuration inheritance via local file paths or file:// URLs (mirroring tsconfig.json and ESLint conventions): extends: './tempo-base.json'.
  • Plugin Registration (plugins): Pass executable plugins, terms, and modules into plugins: [TickerPlugin, CelestialPlugin].
  • Plugin Configuration Slot (pluginOptions): Pass runtime configuration defaults for plugins into pluginOptions: { ticker: { interval: 500 } }. The 'plugins' key as a JSON of plugin-configuration settings has been migrated to pluginOptions so as not to overload the plugins key (which registers Plugin instances / Terms / Modules / Namespaces).
  • Imperative Registration (Tempo.use): Use the standard Tempo.use(Plugin) static method to register plugins, terms, or modules at runtime. Tempo.extend() is @deprecated Use Tempo.use(...) instead..

Example: ​

javascript
// βœ… v4.1.0: Clean Separation
Tempo.init({
  extends: './tempo-base.json',                                     // Configuration inheritance
  plugins: [TickerPlugin, CelestialPlugin],                         // Feature & Term registration
  pluginOptions: {                                                  // Plugin runtime options
    ticker: { interval: 500 }
  }
});

// βœ… Imperative registration
Tempo.use(TickerPlugin);

πŸ”’ Overloaded Tempo.create() & Scoped Disposal (using) ​

In v4.1.0, Tempo.create() introduces deterministic resource cleanup via TC39 Explicit Resource Management:

  • Scoped Callback Mode: Run isolated operations without leaking sandbox state to the global scope:
    typescript
    const season = Tempo.create((sb) => {
      sb.use(CelestialPlugin);
      return sb('2026-06-21').term.astronomy.season;
    }); // sandbox automatically disposed upon completion
  • TC39 Explicit Resource Management (using):
    typescript
    {
      using sb = Tempo.create({ discovery: 'ephemeral' });
      sb.use(MyPlugin);
    } // sb[Symbol.dispose]() called automatically

πŸ“‚ Data Augmentation (registry: { ... }) ​

All custom format definitions, locale mappings, modifiers, tokens, snippets, layouts, events, periods, ignores, and number-word definitions are consolidated under the registry namespace.

  • Number-Word Mappings: Top-level numbers: { ... } has been moved to registry: { numbers: { ... } }.
  • Custom Formats: Top-level formats: { ... } has been moved to registry: { formats: { ... } }.
  • Global Discovery: Discovery objects (Symbol.for('$Tempo')) use registry: { numbers: { ... }, formats: { ... } } instead of top-level discovery.numbers or discovery.formats.

Example Migration: ​

javascript
// ❌ v3.x (Deprecated)
Tempo.init({
  numbers: { un: 1, deux: 2 },
  formats: { customDate: '{yyyy}-{mm}-{dd}' }
});

// βœ… v4.0.0
Tempo.init({
  registry: {
    numbers: { un: 1, deux: 2 },
    formats: { customDate: '{yyyy}-{mm}-{dd}' }
  }
});

🧹 Deprecated Type & API Cleanup ​

  • Tempo.use vs Tempo.uses: The legacy alias Tempo.uses has been excised. Use Tempo.use().
  • TempoInstance Type: TempoInstance interface alias has been removed in favor of standard Tempo class/instance types.
  • Mutable<T> to MutableObject<T>: The utility type Mutable<T> has been renamed to MutableObject<T> to prevent naming collisions with the @Mutable member decorator and clarify object-level readonly stripping.

πŸš€ Tempo v4.7.0 Updates: Format Masks & Dialects Migration ​

Tempo v4.7.0 formalizes date formatting ergonomics, introduces seamless interop with external library formatting standards via @tempo-kit/plugin-dialects, and guides developers when unbraced masks are detected.

πŸ’‘ The Braced Templating Model: "Template Strings for Dates" ​

In Tempo, native formatting masks follow an intuitive template-literal paradigm ({token}):

  • Zero-Escaping: Plain text requires no escaping. Only tokens enclosed in {...} are replaced.
    typescript
    // In Tempo: no bracket or quote escaping needed around literal words!
    t.format('Meeting on {wkd}, {dd:ord} of {mon} at {h12}:{mi} {mer}');
    // Output: "Meeting on Tuesday, 24th of October at 03:30 pm"
  • Composable with ES Template Strings: Because ECMAScript evaluates backtick template literals (`...`) before passing arguments into .format(), you can seamlessly interpolate application variables alongside Tempo date tokens:
    typescript
    const user = 'Alice';
    const role = 'Admin';
    t.format(`Welcome ${user} (${role})! Your session expires on {wkd} at {h12}:{mi}{mer}`);

πŸ” Migrating from Day.js, Moment.js, and Luxon ​

If your codebase relies on external format strings (YYYY-MM-DD, yyyy-MM-dd, or %Y-%m-%d), you do not need to rewrite your masks.

1. Install @tempo-kit/plugin-dialects ​

bash
npm install @tempo-kit/plugin-dialects

2. Drop-in Replacement for Luxon (toFormat) ​

typescript
import '@tempo-kit/plugin-dialects/install';
import { Tempo } from 'tempo-kit';

const t = new Tempo('2026-10-24');
console.log(t.toFormat('yyyy-MM-dd HH:mm')); // Luxon standard drop-in

3. Automatic Unbraced Mask Routing & Migration Guard ​

When @tempo-kit/plugin-dialects is registered, calling t.format('YYYY-MM-DD') automatically routes through the dialects compiler.

If an unbraced format mask is passed without the dialects plugin installed:

typescript
t.format('YYYY-MM-DD');
// ❌ Throws: [Tempo] Formatting unbraced format mask 'YYYY-MM-DD' requires '@tempo-kit/plugin-dialects'.

This safeguards developers from accidental silent formatting bugs and immediately guides them to the right solution.


⚠️ Migrating to Tempo v3.x ​

Tempo v3.x finalizes the plugin ecosystem by extracting advanced features into standalone, licensed packages.

πŸ” Migrating to Tempo v3.x (Ticker Extraction) ​

The TickerPlugin has been extracted from the core engine into a standalone open-source Community plugin (@tempo-kit/plugin-ticker).

Action Required:

  1. If you use Tempo.ticker(), install @tempo-kit/plugin-ticker alongside tempo-kit.
  2. Import and register the plugin in your application initialization:
    javascript
    import { Tempo } from 'tempo-kit';
    import { TickerPlugin } from '@tempo-kit/plugin-ticker';
    
    Tempo.init({
      plugins: [TickerPlugin]
    });

⚠️ Migrating to Tempo v2.x ​

Tempo v2.x introduces architectural improvements and a more modular engine. While we strive for backward compatibility, there are some key changes to consider when upgrading from v1.x.

πŸ“¦ Modular Architecture ​

Tempo is now split into a core engine and optional modules.

If you use the full package: ​

If you import from tempo-kit, everything (except Plugin extensions, like .ticker()) is included and works exactly like v1.x. No changes are required.

If you want a lean bundle: ​

You can now import the core engine only:

javascript
import { Tempo } from 'tempo-kit/core';

If you do this, you must manually import the features you need. Built-in features now self-register on import via side-effects.

πŸ”Œ Feature Registration ​

Features like mutation, duration, format, and the ticker are now modular.

v1.x (Automatic) ​

In v1.x, all features were always present.

v2.x (Opt-in for Core) ​

If using the Core engine, simply import the module to activate the feature:

javascript
import 'tempo-kit/duration';
import 'tempo-kit/ticker';

πŸ—“οΈ Term Logic Refactor ​

The way Terms (Quarters, Seasons, Zodiacs, etc.) are handled has been unified.

  • v1.x: Some Term properties were ad-hoc on the instance.
  • v2.x: All Term logic is centralized under the .term property or accessible via the # shorthand in .set() and .add().

Example of new syntax:

javascript
// Snap to start of quarter
t.set({ '#quarter': 'start' });

// Add two quarters while preserving day-of-quarter
t.add({ '#quarter': 2 });

πŸš€ Tempo v2.4.0: Standalone Utilities & Path Deprecation ​

Tempo v2.4.0 introduces standalone utility entry points for parse and format.

πŸ› οΈ Standalone Imports ​

You can now import lightweight, tree-shakable versions of our parsing and formatting engines without the Tempo class:

javascript
import { parse } from 'tempo-kit/parse';
import { format } from 'tempo-kit/format';

⚠️ Reorganized Paths ​

We have reorganized the package structure to support these standalone entry points more cleanly.

Action Required:

  1. Use package subpath maps: Update your imports to use the official entry points:

    • ❌ tempo-kit/module/parse
    • ❌ tempo-kit/module/format
    • βœ… tempo-kit/parse
    • βœ… tempo-kit/format
  2. Check your Import Maps: If you use browser-side import maps, ensure they point to package subpath locations rather than internal folder paths. A maintained importmap.json is included in the package root (packages/tempo/importmap.json) as the sanctioned reference for each release.

    Note: The shipped packages/tempo/importmap.json is the supported exception for version-locked internal mappings. Use it as-is for your installed Tempo version instead of hand-authoring dist/ paths.

    Example:

json
{
    "imports": {
        "tempo-kit/parse": "./node_modules/tempo-kit/parse",
        "tempo-kit/format": "./node_modules/tempo-kit/format"
    }
}

πŸ” Migrating from version 2.4 ​

As Tempo grows, it has become much more efficient for our developers to logically re-group certain modules.

Action Required:

  1. Review your browser importmap entries.
  2. Replace any older internal paths with the current package subpath entries (for example, tempo-kit/duration, tempo-kit/mutate, tempo-kit/parse, and tempo-kit/format).
  3. Do not pin imports in your code directly to internal folder layouts in dist/, since those paths may change as modules are reorganized. Instead rely wholly on your import maps.

πŸ” Migrating from version 2.6.0 ​

Season Term scope output has been simplified.

Action Required:

  1. If you previously relied on the Chinese-specific object attached to term.season scope output, remove that dependency.
  2. Resolve Chinese season context by creating a dedicated Tempo instance with the appropriate Chinese timeZone for the interpretation you need.

πŸ” Migrating from version 2.7.0 (Grouped Options) ​

Tempo has rationalized its configuration surface by grouping related options into nested objects. This improves discoverability and allows for easier additive merging across the prototype chain.

Month-Day (Regional Parsing) ​

The individual mdyLocales and mdyLayouts options have been consolidated into a single monthDay object.

  • v2.6.x: new Tempo({ mdyLocales: ['en-US'] })
  • v2.7.x: new Tempo({ monthDay: { locales: ['en-US'] } })
  • Shortcut: new Tempo({ monthDay: true }) (enables forced MDY parsing using default locales).

Relative Time ​

The individual rtfFormat and rtfStyle options have been consolidated into a single relativeTimeFormat object.

  • v2.6.x: new Tempo({ rtfStyle: 'long' })
  • v2.7.x: new Tempo({ relativeTimeFormat: { style: 'long' } })

Action Required: ​

Only the deprecated top-level keys rtfFormat and rtfStyle are still accepted as legacy fallbacks in the current release, handled specifically in the Tempo class constructor for backward compatibility.

In contrast, the old mdyLocales and mdyLayouts keys are not treated as aliases and will be ignored; these must be migrated to the new nested monthDay structure. Update your configuration to ensure compatibility with future versions and the optimization engine. Refer to the Tempo constructor for implementation details on legacy alias handling.

πŸ” Migrating to version 2.9.3 ​

πŸ“ BigInt Precision Resolution ​

A breaking change was introduced to harmonize BigInt handling with numeric inputs.

  • Pre-v2.9.3: BigInt inputs were always treated as raw nanoseconds, regardless of the timeStamp configuration.
  • v2.9.3+: BigInt inputs now respect the configured unit (default 'ms').

Example: ​

javascript
// Before v2.9.3
new Tempo(1000n).ts; // 1000 (nanoseconds)

// After v2.9.3
new Tempo(1000n).ts; // 1000 (milliseconds)

Action Required: ​

If you previously relied on BigInt being treated as nanoseconds, you must now explicitly set the timeStamp unit to 'ns':

javascript
new Tempo(1000n, { timeStamp: 'ns' });

πŸ” Removed Features (v3.0.0) ​

Deprecated Boolean Debug Flag ​

The debug configuration property no longer accepts boolean values. It has been strictly typed to accept numeric verbosity levels matching the internal LOG enum, or lowercase string labels (e.g. 'trace', 'info').

  • Removed: new Tempo({ debug: true })
  • Recommended: new Tempo({ debug: 4 }), new Tempo({ debug: 'debug' }), or new Tempo({ debug: LOG.Debug }) (for parsing verbosity).

Internationalization Naming ​

To better align with ECMAScript standards (specifically Intl.RelativeTimeFormat), the relativeTime configuration option inside intl is no longer supported in v3.0.0.

  • Removed: new Tempo({ intl: { relativeTime: { style: 'long' } } })
  • Recommended: new Tempo({ intl: { relativeTimeFormat: { style: 'long' } } })

Please migrate your configurations from relativeTime to relativeTimeFormat.

πŸ§ͺ Testing and Stability ​

v2.x has been hardened with a 100% pass rate on our regression suite. If you were relying on undocumented "quirks" or bugs in v1.x parsing, you may find that v2.x is more strict and deterministic.

Released under the MIT License.