I have a clock i want to start at 5:00. and I just want to make a button for instance that would subtract 5 seconds so that it displays 4:55. I'm having so much difficulty with this and JS DateTime. I keep getting the error "format is not a function". What am I missing?
var dateTime = new moment(300000);
var clock = dateTime.format('m:ss'); //Displays as 5:00
//Button Click
$scope.rewindClick = function () {
clock = dateTime.diff(5000).format('m:ss');
}
Use moment.js
subtract http://momentjs.com/docs/#/manipulating/subtract/
dateTime.subtract(5, 'seconds').format('m: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