export function formatMessageTimestamp(submittedAt: string, now = new Date()): string { const date = new Date(submittedAt) if (date.toDateString() !== now.toDateString()) { return new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit' }).format(date) } const minutes = Math.max(0, Math.round((now.getTime() - date.getTime()) / 60_000)) if (minutes < 1) return 'Just now' if (minutes < 60) return `${minutes}m ago` return `${Math.round(minutes / 60)}h ago` }