eachDayOfInterval

Calendar
stable

Inclusive day-range iterator. Returns every date at midnight (00:00 local) between from and to. Returns an empty array when to is before from.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

from
required
Date
The start of the interval (inclusive). Time component is discarded — only the calendar date is used.
to
required
Date
The end of the interval (inclusive). Time component is discarded — only the calendar date is used.

API

Return value

The value returned by this util.

An array of Date objects, one per calendar day from from to to (inclusive). Empty array when to < from.

Usage

Examples

Ready-to-paste usage snippets.

Iterating over a date range

typescript