import { strings } from '@/common/strings'; export function formatDateTime(isoString: string): string { const date = new Date(isoString); return date.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', hour: 'numeric', minute: '2-digit', hour12: true, }); } export function formatDateKey(date: Date): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } export function isSameDay(a: Date, b: Date): boolean { return ( a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate() ); } export function getTimeAgo(date: Date): string { const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffMins = Math.floor(diffMs / 60000); if (diffMins < 1) return strings.time.relative.justNow; if (diffMins < 60) return strings.time.relative.minutesAgo(diffMins); const diffHours = Math.floor(diffMins / 60); if (diffHours < 24) return strings.time.relative.hoursAgo(diffHours); return date.toLocaleDateString(); }