export function formatDate( date: string | Date, style: 'short' | 'long' | 'relative' = 'short' ): string { const d = typeof date === 'string' ? new Date(date) : date; if (style === 'short') { return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', }); } if (style === 'long') { return d.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric', }); } // relative const diff = Date.now() - d.getTime(); const seconds = Math.floor(diff / 1000); if (seconds < 60) return 'just now'; const minutes = Math.floor(seconds / 60); if (minutes < 60) return `${minutes}m ago`; const hours = Math.floor(minutes / 60); if (hours < 24) return `${hours}h ago`; const days = Math.floor(hours / 24); return `${days}d ago`; }