question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Formatting duration in multiple time units

See original GitHub issue

Describe 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:open
  • Created 3 years ago
  • Reactions:20
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
glennreyescommented, May 25, 2020

Would also be awesome if we could display it with in zero padded units, such as:

dayjs.duration({ s: 12345678 }).format('HH:mm:ss')

Is there anything like that?

3reactions
Gameghostifycommented, Mar 8, 2021

What’s the status of this? Would love to have this feature as well!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found