Skip to content

fix(timer): show days in formatUsageDuration for durations >= 24h#228

Open
Jaahuo wants to merge 2 commits intosirmalloc:mainfrom
Jaahuo:fix/210-format-days
Open

fix(timer): show days in formatUsageDuration for durations >= 24h#228
Jaahuo wants to merge 2 commits intosirmalloc:mainfrom
Jaahuo:fix/210-format-days

Conversation

@Jaahuo
Copy link
Contributor

@Jaahuo Jaahuo commented Mar 13, 2026

Summary

  • formatUsageDuration() now displays a days component for durations >= 24 hours (e.g. 1d 12hr 30m instead of 36hr 30m)
  • Applies to both normal and compact formats (1d12h30m in compact mode)
  • Zero duration now shows 0m instead of 0hr/0h
  • Simplified implementation: unified compact/normal into a single code path

Fixes #210

Test plan

  • New test cases for normal format with days (1d 1hr, 1d 12hr 30m, 7d)
  • New test cases for compact format with days (1d1h, 1d12h30m, 7d)
  • Zero duration returns 0m in both modes
  • Existing sub-24h tests still pass
  • bun run lint passes

Jaahuo added 2 commits March 13, 2026 13:46
Durations of 24+ hours now display a days component instead of
raw hours (e.g. "1d 12hr 30m" instead of "36hr 30m"). Applies to
both normal and compact formats. Fixes sirmalloc#210.
…ration

Unify compact/normal branches into a single code path differing only
in hour label and separator. Zero duration now displays "0m" instead
of "0hr"/"0h".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formatUsageDuration should show days for durations >= 24h

1 participant