Zero-dependency isomorphic Intl formatting library for JavaScript and TypeScript. Provides seven synchronous, crash-safe methods for numbers, currency, percentages, durations, dates, and relative time with consistent output across server and client (no hydration mismatches). Uses built-in LRU caching for Intl instances. Supports Node.js >=18, React, Next.js App Router, Express, Bun, Deno, and edge runtimes. Under 3KB gzipped. Current stable version: 1.0.3. Release cadence: irregular. Key differentiator: universal runtime support, zero dependencies, and no framework lock-in.
npm install intl-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a formatter with locale 'en-US' and USD currency, then demonstrate all formatting methods.
Define the formatter at module level or memoize with useMemo and stable dependency array.
Upgrade to Node >=18 or use a polyfill like @formatjs/intl.
Use import syntax or dynamic import() instead of require.
Check input validity before formatting or set a distinguishable fallback value like '__INVALID__'.
Convert milliseconds to seconds before calling duration(): fmt.duration(milliseconds / 1000).
Replace require('intl-formatter') with import { createFormatter } from 'intl-formatter'.Change import createFormatter from 'intl-formatter' to import { createFormatter } from 'intl-formatter'.Upgrade to Node >=18 or include polyfill @formatjs/intl.
Check that createFormatter receives an object with locale, currency (if used), and optional rules. Ensure no typo like 'loacle'.