Tempo API
    Preparing search index...

    Tempo API

    Tempo Logo

    Tempo

    The Professional Date-Time Library for the Temporal API

    Tempo is a premium, high-performance wrapper for the ECMAScript Temporal API. Designed for professionals, it combines immutable state-management with a fluent, natural-language engine. It is the modern, type-safe successor to legacy libraries like Moment.js and Luxon.

    Our Mission: Humanizing Temporal. Bringing developer intuition, cultural awareness, and expressive natural-language ergonomics to JavaScript dates—anchored in a rock-solid ISO 8601 baseline. Read our vision & architecture →

    Package Note: tempo-kit (formerly @magmacomputing/tempo in v4) is an independent, Temporal-native date-time engine and is unrelated to @formkit/tempo.

    npm version Socket Security Temporal Documentation Live Interactive REPL


    import { Tempo } from 'tempo-kit';
    import { CelestialPlugin } from '@tempo-kit/plugin-celestial';

    // 🔌 Instantly Extensible (with deterministic defaults)
    Tempo.init({
    plugins: [CelestialPlugin],
    timeZone: 'America/New_York'
    });

    // 🎯 Natural Language Parsing (Deterministic anchor)
    const event = new Tempo('next Friday 3pm', { anchor: '2026-10-15' });

    // 🔄 Fluent Mutations (Immutable)
    const reminder = event.add({ hours: 2 }).set({ minute: 0 });

    // ⏳ Comparative Durations
    const diff = event.until('2026-12-25');
    console.log(diff.iso); // P2M2D

    // 📝 Beautiful Formatting
    console.log(event.format('{mon} {dd:ord}, {yyyy}')); // October 23rd, 2026

    // 🌌 Domain Logic (via Plugin)
    console.log(event.term.astronomy.season); // 'Autumn'

    npm install tempo-kit       # npm
    yarn add tempo-kit # yarn
    pnpm add tempo-kit # pnpm
    bun add tempo-kit # bun
    deno add npm:tempo-kit # deno

    Runtime Support: Requires Node.js >= 20.0.0 (Recommended: Node 24 LTS or Node >= 26.10.0 with full native Temporal support).

    🌐 Browser & Native Environments

    For standard usage natively in the browser, use the pre-optimized Global ESM Bundle. It includes the entire core engine in a single file:

    <script type="importmap">
    {
    "imports": {
    "@js-temporal/polyfill": "https://cdn.jsdelivr.net/npm/@js-temporal/polyfill@0.5.1/dist/index.esm.js",
    "tempo-kit": "https://cdn.jsdelivr.net/npm/tempo-kit@5/dist/tempo.bundle.esm.js"
    }
    }
    </script>

    <script type="module">
    import '@js-temporal/polyfill';
    import { Tempo } from 'tempo-kit';

    const t = new Tempo('next Friday');
    </script>

    Advanced Usage (Tempo Plugins & CDNs) If you need to use Tempo Plugins natively in the browser, require granular module resolution, or want to use on-the-fly bundling CDNs (like esm.sh), please see our comprehensive Installation Guide for detailed import map configurations.


    While the native Temporal API gives you perfect primitives (ZonedDateTime, PlainDate), it doesn't give you business logic. Tempo bridges that gap.

    Feature Native Temporal API The Tempo Ecosystem
    Primitives Perfect (Instant, ZonedDateTime) Powered by Native Primitives ✨
    Timezones IANA String Support Advanced fallback & auto-syncing
    Domain Logic ❌ Build it yourself ✅ Plugins (astro, sync)
    Natural Language ❌ Manual parsing ✅ "next Friday 3pm"
    Formatting ❌ Verbose Intl option bags ✅ Token masks & modifiers ({mon} {dd:ord}, {#qtr})
    • 🗣️ Natural Language & Smart Parsing: Parse natural language phrases (e.g. "next Friday 3pm", "two days ago") with zero-cost lazy evaluation and functional aliases.
    • 🎨 Expressive Formatting: Bracketed layout masks ({wkd}, {mon} {dd:ord}) with modifiers (:ord with configurable localized ordinal dictionaries, :roman, :compact) and semantic Term tokens ({#quarter})—without Intl.DateTimeFormat boilerplate.
    • 🌍 Zero-Bundle Localization: Multi-language date parsing and formatting powered natively by ECMAScript Intl—no heavy static locale dictionaries required.
    • 🧩 Extensible & AI-Ready: Modular plugin ecosystem for astronomical cycles (celestial), fiscal quarters (FiscalTerm), schedulers (ticker), and LLM-powered parsing (ai).
    • 🏗️ Future-Proof & Ultra-Lightweight: Built natively on the ECMAScript Temporal foundation with zero external dependencies and full tree-shaking support.

    For a deeper dive into the API, architecture, and advanced features:


    Tempo is the core library, but the ecosystem extends further:

    Package Description Docs
    tempo-kit Core library — parsing, formatting, natural-language engine Documentation
    tempo-fns Pure functional utilities built on native Temporal & Tempo — tree-shakeable helpers Documentation
    @tempo-kit/plugin-* Official & community plugins — AI, Ticker, Astro, Finance, Sync, Snap, and more Plugin Ecosystem Catalog

    1. Bug Reports & Features: Please open an Issue.
    2. Questions & Ideas: Start a thread in Discussions.
    3. Direct Contact: You can reach us at hello@magmacomputing.com.au.

    🚀 Premium!   |   ⭐ Loving it!   |   💡 Needs work   |   🐞 Found a bug


    Distributed under the MIT License. See LICENSE for more information.