I wanted to check if momentjs
is able to convert a given number of seconds to a ISO 8601 formatted duration string.
E.g. 1000 seconds will lead to PT16M40S
.
I wanted to check if momentjs
is able to convert a given number of seconds to a ISO 8601 formatted duration string.
E.g. 1000 seconds will lead to PT16M40S
.
- npmjs./package/moment-duration – Dan Wilson Commented Nov 14, 2016 at 14:52
- using a library to replace one line of code is kind of crazy. – Paul Rooney Commented Sep 9, 2019 at 4:21
1 Answer
Reset to default 11You can use toISOString
on the duration:
moment.duration(1000, 'seconds').toISOString() //"PT16M40S"
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744241871a4564743.html
评论列表(0条)