addDays

Date
stable

Return a new Date shifted by the given number of days. 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. Not mutated.
amount
required
number
Number of days to add. Negative values subtract days.

API

Return value

The value returned by this util.

A new Date instance offset by the specified number of days.

Usage

Examples

Ready-to-paste usage snippets.

Add and subtract days

typescript