1 | import type { LocalizedOptions, WeekOptions } from "./types.js";
|
2 | /**
|
3 | * The {@link startOfWeek} function options.
|
4 | */
|
5 | export interface StartOfWeekOptions
|
6 | extends LocalizedOptions<"options">,
|
7 | WeekOptions {}
|
8 | /**
|
9 | * @name startOfWeek
|
10 | * @category Week Helpers
|
11 | * @summary Return the start of a week for the given date.
|
12 | *
|
13 | * @description
|
14 | * Return the start of a week for the given date.
|
15 | * The result will be in the local timezone.
|
16 | *
|
17 | * @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).
|
18 | *
|
19 | * @param date - The original date
|
20 | * @param options - An object with options
|
21 | *
|
22 | * @returns The start of a week
|
23 | *
|
24 | * @example
|
25 | * // The start of a week for 2 September 2014 11:55:00:
|
26 | * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
|
27 | * //=> Sun Aug 31 2014 00:00:00
|
28 | *
|
29 | * @example
|
30 | * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
|
31 | * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
|
32 | * //=> Mon Sep 01 2014 00:00:00
|
33 | */
|
34 | export declare function startOfWeek<DateType extends Date>(
|
35 | date: DateType | number | string,
|
36 | options?: StartOfWeekOptions,
|
37 | ): DateType;
|