javascript - .diff is not a function on moments.js -


i try little script using moment.js, shows me how many hours , minutes (seperate) have until specific hour.

var timea = moment('08:00:00', 'hh:mm:ss').format('hh:mm:ss'); var timeb = moment('16:00:00', 'hh:mm:ss').format('hh:mm:ss'); var diffab = timea.diff(timeb); var diffhours = diffab.format('h'); var diffminutes = diffab.format('mm');  console.log('timea: ' + timea); console.log('timeb: ' + timeb); console.log('difference a-b: ' + diffab); console.log('diff hours: ' + diffhours); console.log('diff minutes: ' + diffminutes); 

thats i've tried far. following error:

timea.diff not function 

i not sure doing wrong here.

when call .format(), string. you're no longer dealing moment object.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -