export function formatDuration(ms: number | null | undefined): string { if (ms === null || ms === undefined) return "—"; if (ms < 1000) return `${ms}ms`; if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`; return `${(ms / 60000).toFixed(1)}m`; } export function formatRelativeTime(date: string | Date): string { const now = new Date(); const then = typeof date === "string" ? new Date(date) : date; const diffMs = now.getTime() - then.getTime(); const diffSec = Math.floor(diffMs / 1000); if (diffSec < 60) return "just now"; const diffMin = Math.floor(diffSec / 60); if (diffMin < 60) return `${diffMin}m ago`; const diffHour = Math.floor(diffMin / 60); if (diffHour < 24) return `${diffHour}h ago`; const diffDay = Math.floor(diffHour / 24); return `${diffDay}d ago`; } import { type ClassValue, clsx } from "clsx"; import { twMerge } from "tailwind-merge"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); }