I am trying to convert seconds in HH:MM:SS format. I am getting an error moment.duration is not a function.
var moment = require("moment-duration-format");
moment.duration(123, "seconds").format("hh:mm:ss");
var duration = moment. duration("09:30"); var str = moment(duration. _data). format("HH:mm");
Moment JS allows displaying of date as per localization and in human readable format. You can use MomentJS inside a browser using the script method. It is also available with Node. js and can be installed using npm.
The moment-duration-format
plugin depends on moment
, so you should import/require it first:
var moment = require("moment")
require("moment-duration-format");
moment.duration(123, "seconds").format("hh:mm:ss");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With