UNPKG

1.5 kBTypeScriptView Raw
1import type { ContextOptions, DateArg } from "./types.js";
2/**
3 * The {@link startOfISOWeekYear} function options.
4 */
5export interface StartOfISOWeekYearOptions<DateType extends Date = Date>
6 extends ContextOptions<DateType> {}
7/**
8 * @name startOfISOWeekYear
9 * @category ISO Week-Numbering Year Helpers
10 * @summary Return the start of an ISO week-numbering year for the given date.
11 *
12 * @description
13 * Return the start of an ISO week-numbering year,
14 * which always starts 3 days before the year's first Thursday.
15 * The result will be in the local timezone.
16 *
17 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
18 *
19 * @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).
20 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
21 *
22 * @param date - The original date
23 * @param options - An object with options
24 *
25 * @returns The start of an ISO week-numbering year
26 *
27 * @example
28 * // The start of an ISO week-numbering year for 2 July 2005:
29 * const result = startOfISOWeekYear(new Date(2005, 6, 2))
30 * //=> Mon Jan 03 2005 00:00:00
31 */
32export declare function startOfISOWeekYear<
33 DateType extends Date,
34 ResultDate extends Date = DateType,
35>(
36 date: DateArg<DateType>,
37 options?: StartOfISOWeekYearOptions<ResultDate> | undefined,
38): ResultDate;