Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
23 lines (18 sloc) 572 Bytes
title version signature
Subtract Time
moment.duration().subtract(Number, String); moment.duration().subtract(Number); moment.duration().subtract(Duration); moment.duration().subtract(Object);

Mutates the original duration by subtracting time.

The same keys and shorthands used to create durations can be used here as the second argument.

var a = moment.duration(3, 'd');
var b = moment.duration(2, 'd');
a.subtract(b).days(); // 1

Note that adding an invalid duration to any other duration results in an invalid duration.