Duration format result is not as expected
See original GitHub issueDescribe the bug
When use duration format for an ISO8601, result it’s not as expected :
myDuration = dayjs.duration('PT3M39.096S')
myDuration.format("HH:mm:ss") => "NaN:03:39.096"
myDuration.format("mm:ss") => "03:39.096"
myDuration.format("ss") => "39.096"
myDuration.format("SSS") => "undefined"
Expected behavior
myDuration.format("HH:mm:ss") => "00:03:39"
myDuration.format("mm:ss") => "03:39"
myDuration.format("ss") => "39"
myDuration.format("SSS") => "096"
Information
- Day.js Version [1.10.5]
- OS: [Windows]
- Browser [chrome 90]
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Format Duration on Y-Axis not as expected - Apple Community
Hi, my graphs work but I find that the format of Duration on Y-Axis not as expected, it is showing as decimals and...
Read more >How to use format() on a moment.js duration? - Stack Overflow
Show activity on this post. If the duration is > of 86400'' (i.e. 24h), this will not work. It's the same in excel,...
Read more >DURATION NUMBER FORMAT NO LONGER WORKS!
The first group of values in column A is correctly formatted as durations with the format pattern [h]:mm:ss . The second group of...
Read more >Duration (Java Platform SE 8 ) - Oracle Help Center
The model is of a directed duration, meaning that the duration may be negative. The duration is measured in "seconds", but these are...
Read more >Cannot format DAX measure to the expected output
Unfortunately, I cannot change the data type to Date Time, because it is not a calculated column. I already tried to transfer the...
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

🎉 This issue has been resolved in version 1.10.7 🎉
The release is available on:
Your semantic-release bot 📦🚀
I’ve just hit this problem and I’ve found that calling
duration.add(0, 'seconds')on a broken instance ofDurationwill return an instance where theNaNcomponents will be replaced with0s.