1 | import type { ContextOptions, DateArg } from "./types.js";
|
2 | /**
|
3 | * The {@link nextSunday} function options.
|
4 | */
|
5 | export interface NextSundayOptions<DateType extends Date = Date>
|
6 | extends ContextOptions<DateType> {}
|
7 | /**
|
8 | * @name nextSunday
|
9 | * @category Weekday Helpers
|
10 | * @summary When is the next Sunday?
|
11 | *
|
12 | * @description
|
13 | * When is the next Sunday?
|
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 if a context is provided.
|
17 | *
|
18 | * @param date - The date to start counting from
|
19 | * @param options - An object with options
|
20 | *
|
21 | * @returns The next Sunday
|
22 | *
|
23 | * @example
|
24 | * // When is the next Sunday after March 22, 2020?
|
25 | * const result = nextSunday(new Date(2020, 2, 22))
|
26 | * //=> Sun Mar 29 2020 00:00:00
|
27 | */
|
28 | export declare function nextSunday<
|
29 | DateType extends Date,
|
30 | ResultDate extends Date = DateType,
|
31 | >(
|
32 | date: DateArg<DateType>,
|
33 | options?: NextSundayOptions<ResultDate> | undefined,
|
34 | ): ResultDate;
|