import { type FormatOptions } from './tokens.js'; export interface DistanceCutoffs { seconds?: number; minutes?: number; hours?: number; days?: number; months?: number; } export interface FormatDistanceOptions extends FormatOptions { /** * 'auto' (default) lets Intl.RelativeTimeFormat use natural forms like * "yesterday"/"tomorrow"/"now" when the rounded value lands on ±1 or 0. * 'always' forces the strict "1 day ago"/"in 1 day"/"in 0 seconds" form. */ numeric?: 'always' | 'auto'; /** * Override the unit-selection boundaries (seconds→minutes, * minutes→hours, hours→days, days→months, months→years). Any * subset can be supplied; omitted boundaries fall back to the * defaults (60s, 60min, 24h, 30d, 365d). Values are in each * unit's native scale except `months`, which is in days — see * DistanceCutoffs. Throws descriptively on non-monotonic * boundaries or non-positive values, rather than producing * confusing output downstream. */ cutoffs?: DistanceCutoffs; } /** * Returns a human-readable relative-time string describing `date1` * relative to `date2`, e.g. "3 days ago", "in 2 hours", "now". Delegates * unit names and pluralization to `Intl.RelativeTimeFormat` so the * output localizes the same way the rest of the library's locale-aware * tokens do. * * Convention: the result describes `date1`'s position relative to * `date2`. `formatDistance(now, threeDaysAgo)` → `"3 days ago"` (the * past date is described relative to now). `formatDistance(now, twoHoursFromNow)` * → `"in 2 hours"`. This matches the natural-language reading "describe * the first date as if standing at the second one." * * Unit-selection cutoffs (seconds → minutes → hours → days → months → * years) and the rationale for each are documented in the README under * "formatDistance". * * @example * formatDistance(threeDaysAgo, today) // "3 days ago" * formatDistance(twoHoursFromNow, today) // "in 2 hours" * formatDistance(today, today) // "now" * formatDistance(futureDate, today, {locale:'fr-FR'}) // "dans 2 jours" */ export declare function formatDistance(date1: unknown, date2: unknown, options?: FormatDistanceOptions): string; /** * Same as formatDistance(date, now), where "now" is read from the system * clock at call time. Convenience wrapper for the common "how long ago * was this" case, so the caller doesn't have to construct a reference * value themselves. * * Unlike formatRelativeToNow() (in relativeTime.ts), which only needs * calendar-day resolution, this reads the full wall-clock time (hour * through millisecond) off the system clock — formatDistance's unit * selection is ms-resolution, so a date-only "now" would misclassify * anything under 24 hours old (e.g. "1 hour ago" reading as "in 23 * hours" against a midnight-truncated reference). See the test file * for a regression case covering exactly that. * * The reference is captured fresh on every call, not memoized — each * call reflects "now" at the moment it runs, same expectation * formatRelativeToNow() already sets. * * @example * formatDistanceToNow(threeHoursAgo) // "3 hours ago" * formatDistanceToNow(tomorrow) // "in 1 day" (auto: "tomorrow") */ export declare function formatDistanceToNow(date: unknown, options?: FormatDistanceOptions): string;