UNPKG

1.3 kBTypeScriptView Raw
1import type { Interval, StepOptions } from "./types.js";
2/**
3 * The {@link eachDayOfInterval} function options.
4 */
5export interface EachDayOfIntervalOptions extends StepOptions {}
6/**
7 * @name eachDayOfInterval
8 * @category Interval Helpers
9 * @summary Return the array of dates within the specified time interval.
10 *
11 * @description
12 * Return the array of dates within the specified time interval.
13 *
14 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
15 *
16 * @param interval - The interval.
17 * @param options - An object with options.
18 *
19 * @returns The array with starts of days from the day of the interval start to the day of the interval end
20 *
21 * @example
22 * // Each day between 6 October 2014 and 10 October 2014:
23 * const result = eachDayOfInterval({
24 * start: new Date(2014, 9, 6),
25 * end: new Date(2014, 9, 10)
26 * })
27 * //=> [
28 * // Mon Oct 06 2014 00:00:00,
29 * // Tue Oct 07 2014 00:00:00,
30 * // Wed Oct 08 2014 00:00:00,
31 * // Thu Oct 09 2014 00:00:00,
32 * // Fri Oct 10 2014 00:00:00
33 * // ]
34 */
35export declare function eachDayOfInterval<DateType extends Date>(
36 interval: Interval<DateType>,
37 options?: EachDayOfIntervalOptions,
38): DateType[];