Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 658x 658x 658x 658x 658x 658x 658x 658x 1144x 1144x 1144x 2464x 1370x 1370x 1370x 1346x 1310x 1310x 948x 948x 948x 24x 24x | export function formatDateTime(dateStr: string | null | undefined): string {
I if (!dateStr) return '\u2014'
const d = new Date(dateStr)
const year = d.getFullYear()
const month = String(d.getMonth() + 1).padStart(2, '0')
const day = String(d.getDate()).padStart(2, '0')
const hours = String(d.getHours()).padStart(2, '0')
const minutes = String(d.getMinutes()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}`
}
eIxport function abbreviateNumber(n: number | undefined | null): string {
I if (n == null) return '\u2014'
E if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`
if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K`
return String(n)
}
export function formatRelativeTime(dateStr: string | null | undefined): string {
Iif (!dateStr) return 'Never'
const diff = Date.now() - new Date(dateStr).getTime()
const mins = Math.floor(diff / 60000)
Iif (mins < 1) return 'now'
if (mins < 60) return `${mins} min ago`
const hours = Math.floor(mins / 60)
I if (hours < 24) return `${hours}h ago`
const days = Math.floor(hours / 24)
Iif (days < 7) return `${days}d ago`
return new Date(dateStr).toLocaleDateString()
}
|