addWeeks

A function that adds and subtracts weeks from a Date object.

addWeeks(new Date(2016, 5, 1), 3); // 2016-6-22
addWeeks(new Date(2016, 5, 1), -3); // 2015-5-11

Parameters

date Date

The initial date value.

offset number

The number of weeks to add/subtract from the date.

Returns

Date - A new Date instance.

 /