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 | 7x 7x 7x 7x 7x 23x 22x 22x 22x 22x 7x 4x | const MINUTE_MS = 60000
const HUNDREDTHS_PER_SECOND = 100
const HUNDREDTHS_PER_MINUTE = 6000
const FLOAT_TOLERANCE = 1e-6
export const stopwatch = (seconds: number | null) => {
if (seconds === null) return '—'
const hundredths = Math.floor(seconds * HUNDREDTHS_PER_SECOND + FLOAT_TOLERANCE)
const minutes = Math.floor(hundredths / HUNDREDTHS_PER_MINUTE)
const rest = ((hundredths % HUNDREDTHS_PER_MINUTE) / HUNDREDTHS_PER_SECOND).toFixed(2).padStart(5, '0')
return `${minutes}:${rest}`
}
export const minutesLeft = (until: string, now: Date) =>
Math.max(1, Math.ceil((new Date(until).getTime() - now.getTime()) / MINUTE_MS))
|