Repository navigation
Commit 8d31469
fix(shared): roll a sub-minute duration up to "1m" instead of "60s"
`formatDuration` renders durations under a minute with
`${Math.round(durationMs / 1_000)}s`. For any value in [59_500, 60_000) that
rounds to 60 and prints "60s". The >= 60_000 branch already guards this exact
case (`if (seconds === 60) return `${minutes + 1}m``), so the sub-minute branch
was inconsistent with it: `formatDuration(59_500)` gave "60s" while
`formatDuration(60_000)` gives "1m".
Round first and roll 60 up to "1m". This is user-visible via thread duration
display (`apps/mobile/src/lib/threadActivity.ts`). Added a test file for
`formatDuration` covering the boundary and the surrounding formats.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>1 parent e482960 commit 8d31469
2 files changed
Lines changed: 36 additions & 1 deletion
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
0 commit comments