Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 538 Bytes

12-add.md

File metadata and controls

24 lines (18 loc) · 538 Bytes
title version signature
Add Time
2.1.0
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.