getPreviousMonth

Commons
stable

Returns a new Date set to the first day of the month that precedes the given date, without mutating the input.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

date
required
Date
The reference date. Its year and month are used to compute the preceding month; the input is not mutated.

API

Return value

The value returned by this util.

A new Date object pointing to the 1st of the previous month at midnight local time.

Usage

Examples

Ready-to-paste usage snippets.

Navigate to the previous calendar month

typescript