0
I have two dates and I need to make a delta of these dates to add in the following ones. See below:
data1 = 2020-08-14T10:02 data2 = 2020-08-14T10:07
The code below brings the difference of these dates:
var a = moment('2020-08-14T10:02');
var b = moment('2020-08-14T10:07');
console.log(b.diff(a, 'minutes'))
console.log(b.diff(a, 'hours'))
console.log(b.diff(a, 'days'))
console.log(b.diff(a, 'weeks'))
//5
//0
//0
//0
Now I want the date3 to be "2020-08-14T10:07" and add the 5 minutes difference in the date4, can help me?
Very well explained and this seems to be the way, but strange that for me the var d is picking the same date of c and is not adding the difference.
– user8811593
You generated
d
from a clone ofc
?– Andre
Yes, it looked like this: var d = c.clone(). add(diff);
– user8811593