import { type FormatOptions } from './tokens.js'; export interface DurationFormatOptions extends FormatOptions { /** * When true, units whose value is zero are still emitted in the output * (e.g. "0 hours, 30 minutes" instead of "30 minutes"). Default is * false: zero-value units are omitted, matching how date-fns's * formatDuration works and how most callers rendering a duration to * a human would want it. */ showZeroValues?: boolean; } /** * Format a Temporal.Duration (or a plain field bag { years, months, ... * }) using a duration-specific token string. Token grammar is documented * in the README under "Duration formatting" — it does NOT reuse the * date/time token table, since a duration has no calendar position. * * Zero-value units are omitted by default; pass { showZeroValues: true } * to force them to appear. * * Unit-name localization: without a `locale`, output is the original * English hardcoded singular/plural forms (byte-identical to previous * versions). With a `locale`, the short/long forms delegate to * `Intl.NumberFormat`'s `style: 'unit'` — same approach `formatDistance` * already uses for `Intl.RelativeTimeFormat`. Numeric-only tokens * (`y`, `o`, `w`, ...) are not affected by `locale`; they remain ASCII * digits, matching the rest of this library's "numbers stay Western" * convention. * * @example * formatDuration(Temporal.Duration.from({ years: 2, months: 1 }), 'yyy ooo') * // "2 years 1 month" * formatDuration({ hours: 2, minutes: 30 }, 'hhh mmm', { locale: 'fr-FR' }) * // "2 heures 30 minutes" */ export declare function formatDuration(duration: Record, formatStr: string, options?: DurationFormatOptions): string; export interface RenderedDurationPiece { kind: 'literal' | 'token'; value: string; token?: string; } export declare function renderDurationPieces(duration: Record, formatStr: string, options?: DurationFormatOptions): RenderedDurationPiece[];