addWeeks

Commons
stable

Return a new Date that is the given number of weeks after the input date. The original date is never mutated.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

date
required
Date
The base date. A copy is made internally so the input is not modified.
amount
required
number
Number of weeks to add. Negative values subtract weeks.

API

Return value

The value returned by this util.

A new Date set to date + (amount × 7) days.

Usage

Examples

Ready-to-paste usage snippets.

Add and subtract weeks

typescript