Feature request: Formatting duration in multiple time units
See original GitHub issueDescribe the bug
Formatting duration via .humanize() could be also achieved with multiple time units. e.g.
moment.duration({ s: 100 }).humanize({ s: true }) // '100 seconds'
moment.duration({ s: 100 }).humanize({ m: true }) // '1 minute'
moment.duration({ s: 100 }).humanize({ m: true, s: true }) // '1 minute 40 seconds'
moment.duration({ s: 100 }).humanize({ ms: true }) // '10000 milliseconds'
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Feature request: Formatting duration in multiple time units #4344
Since moment already has locale strings for each time units, we can compose the duration with existing unit strings by mathematical modulus( ...
Read more >Feature request - more value formatting for dashboards
Format number of seconds as time – If I have a value like 135 seconds, I'd like to show it as “2:15” or...
Read more >How to use format() on a moment.js duration? - Stack Overflow
js format is not working as it is supposed to. The solution is to transform seconds to milliseconds and use UTC time. moment.utc(moment.duration(value ......
Read more >Unit test reports - GitLab Docs
First, GitLab Runner uploads all JUnit report format XML files as artifacts to GitLab. Then, when you visit a merge request, GitLab starts...
Read more >Metrics Units - Datadog Docs
Time units between a minute and a year are split into multiple units to be more human-readable. The following conventions apply: Short times...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Would also be awesome if we could display it with in zero padded units, such as:
Is there anything like that?
What’s the status of this? Would love to have this feature as well!