Using Duration with Diff2.1.0+
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
.
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .