Date.prototype.subtract >= 0.1.4

Purpose

Subtract a unit of time from the current date

Syntax

Date#subtract ( 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");>>> Wed Aug 26 2015 17:29:00 GMT+0200 (CEST)

a.subtract(1, 'second');>>> Wed Aug 26 2015 17:28:59 GMT+0200 (CEST)

a.subtract(2, 'hours');>>> Wed Aug 26 2015 15:28:59 GMT+0200 (CEST)

a.subtract(1, 'year');>>> Tue Aug 26 2014 15:28:59 GMT+0200 (CEST)