ENH - clock app

This commit is contained in:
Eichenholz
2026-08-04 15:20:42 +02:00
parent 723eec5ef9
commit c6bac5b2c6
13 changed files with 944 additions and 54 deletions
+8
View File
@@ -4,6 +4,7 @@ import {
formatStopwatch,
formatTimer,
remainingMilliseconds,
timerProgressRatio,
timerPickerMilliseconds,
timerPickerValue,
} from './clock'
@@ -23,4 +24,11 @@ describe('timestamp clocks', () => {
it('formats stopwatch durations with actual milliseconds', () => {
expect(formatStopwatch(61_234)).toBe('01:01.234')
})
it('calculates bounded timer progress from remaining duration', () => {
expect(timerProgressRatio(7_500, 10_000)).toBe(0.75)
expect(timerProgressRatio(-1, 10_000)).toBe(0)
expect(timerProgressRatio(12_000, 10_000)).toBe(1)
expect(timerProgressRatio(0, 0)).toBe(0)
})
})