(updatedAt: number)
| 30 | } |
| 31 | |
| 32 | export function formatRelativeAge(updatedAt: number): string { |
| 33 | const diff = Date.now() - updatedAt |
| 34 | if (diff < 0) return 'just now' |
| 35 | const minutes = Math.floor(diff / 60_000) |
| 36 | if (minutes < 1) return 'just now' |
| 37 | if (minutes < 60) return `${minutes}m ago` |
| 38 | const hours = Math.floor(minutes / 60) |
| 39 | if (hours < 24) return `${hours}h ago` |
| 40 | const days = Math.floor(hours / 24) |
| 41 | if (days < 30) return `${days}d ago` |
| 42 | const months = Math.floor(days / 30) |
| 43 | if (months < 12) return `${months}mo ago` |
| 44 | return `${Math.floor(months / 12)}y ago` |
| 45 | } |
| 46 | |
| 47 | export function pad(value: string, width: number): string { |
| 48 | if (value.length >= width) return value |
no outgoing calls
no test coverage detected