1 | import type {
|
2 | ContextOptions,
|
3 | DateArg,
|
4 | LocalizedOptions,
|
5 | WeekOptions,
|
6 | } from "./types.js";
|
7 | /**
|
8 | * The {@link endOfWeek} function options.
|
9 | */
|
10 | export interface EndOfWeekOptions<DateType extends Date = Date>
|
11 | extends WeekOptions,
|
12 | LocalizedOptions<"options">,
|
13 | ContextOptions<DateType> {}
|
14 | /**
|
15 | * @name endOfWeek
|
16 | * @category Week Helpers
|
17 | * @summary Return the end of a week for the given date.
|
18 | *
|
19 | * @description
|
20 | * Return the end of a week for the given date.
|
21 | * The result will be in the local timezone.
|
22 | *
|
23 | * @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).
|
24 | * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
25 | *
|
26 | * @param date - The original date
|
27 | * @param options - An object with options
|
28 | *
|
29 | * @returns The end of a week
|
30 | *
|
31 | * @example
|
32 | * // The end of a week for 2 September 2014 11:55:00:
|
33 | * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
34 | * //=> Sat Sep 06 2014 23:59:59.999
|
35 | *
|
36 | * @example
|
37 | * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
|
38 | * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
39 | * //=> Sun Sep 07 2014 23:59:59.999
|
40 | */
|
41 | export declare function endOfWeek<
|
42 | DateType extends Date,
|
43 | ResultDate extends Date = DateType,
|
44 | >(date: DateArg<DateType>, options?: EndOfWeekOptions<ResultDate>): ResultDate;
|