Date.prototype.add >= 0.1.4
Purpose
Add a unit of time to the current date
Syntax
Date#add
(
Numberamount
Stringunit
);
Parameters
amount
unit
- year, month, week, day, ...
Return values
Date
Returns itself
Examples
var a = new Date("2015-08-26T15:29:00.000Z");
a.add(1, 'second');
//>>> Wed Aug 26 2015 17:29:01 GMT+0200 (CEST)
a.add(2, 'seconds');>>> Wed Aug 26 2015 17:29:03 GMT+0200 (CEST)
a.add(4, 'weeks');>>> Wed Sep 23 2015 17:29:03 GMT+0200 (CEST)
Comments