Repository navigation
In WebUI show pretty durations as hours and minutes via Intl.DurationFormat - #7530
Merged
Merged
Conversation
59.6 seconds read "60 seconds" and 59.6 minutes "60 minutes"; pick the larger unit once the rounded count reaches it.
Member
|
I think 1h30min should be displayed as such ... the carrence can be 5min ... |
Member
|
also what about using browser api |
6543
self-requested a review
November 10, 2026 18:33
Contributor
Author
|
Thanks, both good points. Pushed a follow-up:
|
Member
|
well the 5min idea i did not formulated to well ... |
6543
approved these changes
Nov 10, 2026
Member
|
ahh ... i missed the <= 5min to next full hour... |
6543
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
prettyDurationpicks its unit from the raw value and then rounds, so a duration just under a unit boundary is shown in the smaller unit with the boundary count:This now also moves up a unit when the rounded count reaches it (
Math.round(totalSeconds) >= 60,Math.round(totalMinutes) >= 60). Durations away from a boundary format exactly as before.Test
New
web/src/compositions/useDate.test.ts: unchanged output for ordinary durations, plus 59.6 s / 59.6 min (now "1 minute" / "1 hour") and 59.4 s / 59.4 min (still "59 seconds" / "59 minutes"). The rounding case fails onmain(Received: "60 seconds") and passes with the fix.prettier -candeslint --max-warnings 0are clean on both files.This change was prepared with AI assistance; I reviewed it and ran the test above locally.