Skip to content
Go to file
Cannot retrieve contributors at this time
17 lines (14 sloc) 533 Bytes
title version signature
Using Duration with Diff
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:

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

See here for more information about moment#diff.