import { type Signalish } from '@nano_kit/store'; import type { Format } from './types.js'; export type RelativeTimeUnit = Exclude; export interface RelativeTimeOptions extends Intl.RelativeTimeFormatOptions { /** * The largest unit to format in, `'year'` by default. */ largestUnit?: RelativeTimeUnit; /** * The smallest unit to format in, `'second'` by default. */ smallestUnit?: RelativeTimeUnit; /** * The moment to count from, the current time by default. A signal or an accessor is followed. */ relativeTo?: Signalish; } /** * Creates a relative time formatter in raw mode. * @param options - Pass `false` to return the input value without formatting. * @returns Formatter that returns the input value or `undefined`. */ export declare function relativetime(options: false): Format; /** * Creates a locale-aware relative time formatter. It counts the distance from the input to * `relativeTo` and formats it in the largest unit the distance fills. * @param options - `Intl.RelativeTimeFormat` options with the unit range and the moment to count from. * @returns Formatter that returns a formatted string or `undefined`. */ export declare function relativetime(options?: RelativeTimeOptions): Format; /** * Creates a relative time formatter in raw mode with a fallback value. * @param fallback - Value returned when the input is `undefined` or `null`. * @param options - Pass `false` to return the input value or fallback without formatting. * @returns Formatter that returns the input value or fallback. */ export declare function relativetime(fallback: Date | number | string, options: false): Format; /** * Creates a locale-aware relative time formatter with a fallback value. * @param fallback - Value used when the input is `undefined` or `null`. * @param options - `Intl.RelativeTimeFormat` options with the unit range and the moment to count from, or `{}` for the defaults. * @returns Formatter that returns a formatted string or `undefined`. */ export declare function relativetime(fallback: Date | number | string, options: RelativeTimeOptions): Format; //# sourceMappingURL=relativetime.d.ts.map