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 | 216x 952x 952x 936x 936x 936x 3x 3x 2x 2x 2x 2726x 6x | interface DurationDisplayProps {
ms: number | null
}
function formatDuration(ms: number): string {
const totalSec = Math.floor(ms / 1000)
if (totalSec < 60) return `${totalSec}s`
E const min = Math.floor(totalSec / 60)
const sec = totalSec % 60
if (min < 60) return sec > 0 ? `${min}m ${sec}s` : `${min}m`
const hours = Math.floor(min / 60)
const remMin = min % 60
return remMin > 0 ? `${hours}h ${remMin}m` : `${hours}h`
}
export function DurationDisplay({ ms }: DurationDisplayProps) {
return <span>{ms === null ? '\u2014' : formatDuration(ms)}</span>
}
|