I’m using moment js to format milliseconds into a mm:ss
format with the following code
moment(myVariable).format('mm:ss');
This works perfectly fine, however a requirement for the app I’m building needs to show 60 minutes as 60:00
rather than using hours like 01:00:00
. I came across another post that suggested doing
moment.duration(myVariable, 'seconds').asMinutes();
however it formats 3,600,000 milliseconds
into minutes as 60000
instead of 60:00
. Is there a way to make it display as 60:00
?
2
Answers
You can generate string manually:
Alternatively, you can consider using
.diff
method: