UNPKG

1.33 kBTypeScriptView Raw
1import type { Interval, StepOptions } from "./types.js";
2/**
3 * The {@link eachMinuteOfInterval} function options.
4 */
5export interface EachMinuteOfIntervalOptions extends StepOptions {}
6/**
7 * @name eachMinuteOfInterval
8 * @category Interval Helpers
9 * @summary Return the array of minutes within the specified time interval.
10 *
11 * @description
12 * Returns the array of minutes 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 minutes from the minute of the interval start to the minute of the interval end
20 *
21 * @example
22 * // Each minute between 14 October 2020, 13:00 and 14 October 2020, 13:03
23 * const result = eachMinuteOfInterval({
24 * start: new Date(2014, 9, 14, 13),
25 * end: new Date(2014, 9, 14, 13, 3)
26 * })
27 * //=> [
28 * // Wed Oct 14 2014 13:00:00,
29 * // Wed Oct 14 2014 13:01:00,
30 * // Wed Oct 14 2014 13:02:00,
31 * // Wed Oct 14 2014 13:03:00
32 * // ]
33 */
34export declare function eachMinuteOfInterval<DateType extends Date>(
35 interval: Interval<DateType>,
36 options?: EachMinuteOfIntervalOptions,
37): DateType[];