@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
18 lines • 897 B
TypeScript
export declare const SECOND_MS = 1000;
export declare const MINUTE_MS = 60000;
export declare const HOUR_MS = 3600000;
export declare const DAY_MS = 86400000;
export declare const WEEK_MS: number;
/**
* Formats a timestamp into a human-readable relative or absolute time label
* using native Intl APIs (RelativeTimeFormat for < 7 days, DateTimeFormat for older dates).
*
* Returns null when the timestamp is less than 1 minute old (caller should
* treat this as "up to date" and display the appropriate message).
*
* @param timestamp - The past timestamp in milliseconds.
* @param locale - BCP 47 locale string used for formatting (e.g. "en", "fr").
* @param now - Current time in milliseconds (defaults to Date.now(), injectable for testing).
*/
export declare function formatTimeAgo(timestamp: number, locale: string, now?: number): string | null;
//# sourceMappingURL=timeAgo.d.ts.map