MomentJS - Add Time


Advertisements

This method adds time to the current duration.

Syntax

moment.duration().add(Number, String);
moment.duration().add(Number);
moment.duration().add(Duration);
moment.duration().add(Object);

Example

var m = moment.duration().add(45, 'd');
var output = JSON.stringify(m._data);

Output

AddTime

Example

var m = moment.duration().add({ days: 7, months: 1 });

Output

Add Time Method
momentjs_durations.htm
Advertisements