registration

This commit is contained in:
User
2025-02-02 16:08:03 +03:00
parent 7f6495eb4d
commit 78afbaed71
6334 changed files with 196774 additions and 165754 deletions

View File

@@ -1,8 +1,26 @@
import type { Interval, StepOptions } from "./types.js";
import type { ContextOptions, Interval, StepOptions } from "./types.js";
/**
* The {@link eachHourOfInterval} function options.
*/
export interface EachHourOfIntervalOptions extends StepOptions {}
export interface EachHourOfIntervalOptions<DateType extends Date = Date>
extends StepOptions,
ContextOptions<DateType> {}
/**
* The {@link eachHourOfInterval} function result type.
* Resolves to the appropriate date type based on inputs.
*/
export type EachHourOfIntervalResult<
IntervalType extends Interval,
Options extends EachHourOfIntervalOptions | undefined,
> = Array<
Options extends EachHourOfIntervalOptions<infer DateType>
? DateType
: IntervalType["start"] extends Date
? IntervalType["start"]
: IntervalType["end"] extends Date
? IntervalType["end"]
: Date
>;
/**
* @name eachHourOfInterval
* @category Interval Helpers
@@ -11,7 +29,8 @@ export interface EachHourOfIntervalOptions extends StepOptions {}
* @description
* Return the array of hours within the specified time interval.
*
* @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).
* @typeParam IntervalType - Interval type.
* @typeParam Options - Options type.
*
* @param interval - The interval.
* @param options - An object with options.
@@ -23,7 +42,7 @@ export interface EachHourOfIntervalOptions extends StepOptions {}
* const result = eachHourOfInterval({
* start: new Date(2014, 9, 6, 12),
* end: new Date(2014, 9, 6, 15)
* })
* });
* //=> [
* // Mon Oct 06 2014 12:00:00,
* // Mon Oct 06 2014 13:00:00,
@@ -31,7 +50,10 @@ export interface EachHourOfIntervalOptions extends StepOptions {}
* // Mon Oct 06 2014 15:00:00
* // ]
*/
export declare function eachHourOfInterval<DateType extends Date>(
interval: Interval<DateType>,
options?: EachHourOfIntervalOptions,
): DateType[];
export declare function eachHourOfInterval<
IntervalType extends Interval,
Options extends EachHourOfIntervalOptions | undefined = undefined,
>(
interval: IntervalType,
options?: Options,
): EachHourOfIntervalResult<IntervalType, Options>;