@t1mmen/srtd
Version:
Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀
30 lines (29 loc) • 944 B
TypeScript
export type TimeFormat = 'time' | 'relative' | 'full';
/**
* Format a date as relative time (e.g., "5m ago", "2h ago").
* Falls back to full format after 7 days.
*/
declare function relative(date: Date | string): string;
/**
* Format a date as HH:MM:SS timestamp (local time).
*/
declare function time(date: Date | string): string;
/**
* Format a date as "Mon DD HH:MM" (e.g., "Dec 28 10:23").
*/
declare function full(date: Date | string): string;
/**
* Unified timestamp formatter with three modes:
* - 'time': HH:MM:SS (for watch activity log)
* - 'relative': "2m ago", "3d ago" (for results table)
* - 'full': "Dec 28 10:23" (for older items)
*/
declare function formatTimestamp(date: Date | string, format: TimeFormat): string;
export declare const formatTime: {
relative: typeof relative;
time: typeof time;
timestamp: typeof time;
full: typeof full;
formatTimestamp: typeof formatTimestamp;
};
export {};