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'
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?
@glennreyes something like this? https://github.com/iamkun/dayjs/issues/641#issuecomment-643924034
@guanzo looks like a sweet solution.
@iamkun is that how you're supposed to do it tho? I sort of tried random combinations of dayjs methods until it worked lmao
@guanzo Don't have a plan yet.
Still, it's a very nice solution and of great inspiration to me.
@iamkun I edited my linked comment. My "solution" only works for durations < 24 hours, and trying it with vanilla moment yields the same issue. I linked a reputable community plugin that does it correctly, dayjs may need something similar. https://github.com/jsmreese/moment-duration-format
This sort-of can be done with duration.$d but I don't think users should access it.
Most helpful comment
Would also be awesome if we could display it with in zero padded units, such as:
Is there anything like that?