| 430 | } |
| 431 | |
| 432 | function formatRelativeAge(updatedAt: number): string { |
| 433 | if (!updatedAt) return ""; |
| 434 | const diff = Date.now() - updatedAt; |
| 435 | if (diff < 0) return "just now"; |
| 436 | const minutes = Math.floor(diff / 60_000); |
| 437 | if (minutes < 1) return "just now"; |
| 438 | if (minutes < 60) return `${minutes}m ago`; |
| 439 | const hours = Math.floor(minutes / 60); |
| 440 | if (hours < 24) return `${hours}h ago`; |
| 441 | const days = Math.floor(hours / 24); |
| 442 | if (days < 30) return `${days}d ago`; |
| 443 | const months = Math.floor(days / 30); |
| 444 | if (months < 12) return `${months}mo ago`; |
| 445 | return `${Math.floor(months / 12)}y ago`; |
| 446 | } |