Is there a way to format var timeValue = '65'
into 01:05
using moment.js? Its easier to format as ('HH:MM:SS') but passing a variable as 65 and converting into ('mm:ss') gives me response as '01:00' not '01:05',
View
<div id="app">
<p>
Time is {{roomTime}}
</p>
<br/>
<p>
How to make it display 01:05 not 01:00
</p>
</div>
Script
new Vue({
el: "#app",
data() {
return{
roomTime: '',
}
},
mounted: function(){
var timeValue = '65'; /** As 65 is 1 minute and 5 seconds **/
var formatTime = moment(timeValue).format("MM:SS");
/** How to make 65 to be display as 01:05 **/
this.roomTime = formatTime;
},
methods: {
toggle: function(todo){
todo.done = !todo.done
}
}
})
Below is my code reference in JSFIDDLE