1 | import type { ContextOptions, DateArg } from "./types.js";
|
2 | /**
|
3 | * The {@link eachWeekendOfYear} function options.
|
4 | */
|
5 | export interface EachWeekendOfYearOptions<DateType extends Date = Date>
|
6 | extends ContextOptions<DateType> {}
|
7 | /**
|
8 | * @name eachWeekendOfYear
|
9 | * @category Year Helpers
|
10 | * @summary List all the Saturdays and Sundays in the year.
|
11 | *
|
12 | * @description
|
13 | * Get all the Saturdays and Sundays in the year.
|
14 | *
|
15 | * @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).
|
16 | * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
17 | *
|
18 | * @param date - The given year
|
19 | * @param options - An object with options
|
20 | *
|
21 | * @returns An array containing all the Saturdays and Sundays
|
22 | *
|
23 | * @example
|
24 | * // Lists all Saturdays and Sundays in the year
|
25 | * const result = eachWeekendOfYear(new Date(2020, 1, 1))
|
26 | * //=> [
|
27 | * // Sat Jan 03 2020 00:00:00,
|
28 | * // Sun Jan 04 2020 00:00:00,
|
29 | * // ...
|
30 | * // Sun Dec 27 2020 00:00:00
|
31 | * // ]
|
32 | * ]
|
33 | */
|
34 | export declare function eachWeekendOfYear<
|
35 | DateType extends Date,
|
36 | ResultDate extends Date = DateType,
|
37 | >(
|
38 | date: DateArg<DateType>,
|
39 | options?: EachWeekendOfYearOptions<ResultDate>,
|
40 | ): ResultDate[];
|