moment.duration().add(Number, String);
moment.duration().add(Number);
moment.duration().add(Duration);
moment.duration().add(Object);
通过增加时间来更改原始的时长。
用于创建时长的相同的键和速记可以在此处用作第二个参数。
var a = moment.duration(1, 'd');
var b = moment.duration(2, 'd');
a.add(b).days(); // 3
注意,将无效的时长添加到任何其他时长会产生无效的时长。
moment.duration().add(Number, String);
moment.duration().add(Number);
moment.duration().add(Duration);
moment.duration().add(Object);
Mutates the original duration by adding time.
The same keys and shorthands used to create durations can be used here as the second argument.
var a = moment.duration(1, 'd');
var b = moment.duration(2, 'd');
a.add(b).days(); // 3
Note that adding an invalid duration to any other duration results in an invalid duration.