MomentJS - Subtract Time


Advertisements

This method will subtract time from a given duration.

Syntax

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

Example

var d = moment.duration(500, 'days');
var st = moment.duration(500, 'days').subtract({ days: 7, months: 1 });

Output

Subtracts
momentjs_durations.htm
Advertisements