javascript - How to debug strange behavior when adding to Moment? -
so precursor information. date calculating from: 2016-04-11t22:12:36.000z
i add 12 hours doing:
var time = new date(d.datecreated) time = number(time) diff = parseint(d.time) * 3600 diff = time + diff
the calculated differences of code is:
console.log(time,diff) //result: 1460412756000 1460412799200
then when run following code:
var m = moment().diff(diff, 'hours') //returns 194 hours
what doing wrong?
you're not reading documentation , utilizing it, that's you're doing wrong. sorry crass...
you want date/time
(from moment docs -- http://momentjs.com/docs/#/manipulating/add/)
moment().add(12, 'hours');
Comments
Post a Comment