Using Duration with Diff2.1.0+

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

You can also use duration with moment#diff to get the duration between two moments. To do so, simply pass the moment#diff method into moment#duration as follows:

  1. var x = new moment()
  2. var y = new moment()
  3. var duration = moment.duration(x.diff(y))
  4. // returns duration object with the duration between x and y

See here for more information about moment#diff.