1moment.duration(2, 'seconds');
2moment.duration(2, 'minutes');
3moment.duration(2, 'hours');
4moment.duration(2, 'days');
5moment.duration(2, 'weeks');
6moment.duration(2, 'months');
7moment.duration(2, 'years');
8moment.duration('2', 'years'); // from 2.25.0
9
10// or create from an object
11moment.duration({
12 seconds: 2,
13 minutes: 2,
14 hours: 2,
15 days: 2,
16 weeks: 2,
17 months: '2',
18 years: '2'
19});
20
21// or create from an iso 8601 string
22moment.duration('P1Y2M3DT4H5M6S');
23moment.duration('P1M');
24
25// duration format strings with a space between days and rest is also supported.
26moment.duration('7 23:59:59.999');
27