MomentJS - Using Duration with Diff



This method is used to get the duration difference between two moments.

Syntax

var duration = moment.duration(x.diff(y))

Example

var d = moment.duration(moment(["2017,07,04"]).diff(moment(["2015,08,20"])));

Output

Diff
momentjs_durations.htm
Advertisements