1.52 kBTypeScriptView Raw
1import type { ContextOptions, DateArg } from "./types.js";
2/**
3 * The {@link subISOWeekYears} function options.
4 */
5export interface SubISOWeekYearsOptions<DateType extends Date = Date>
6 extends ContextOptions<DateType> {}
7/**
8 * @name subISOWeekYears
9 * @category ISO Week-Numbering Year Helpers
10 * @summary Subtract the specified number of ISO week-numbering years from the given date.
11 *
12 * @description
13 * Subtract the specified number of ISO week-numbering years from the given date.
14 *
15 * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
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 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
19 *
20 * @param date - The date to be changed
21 * @param amount - The amount of ISO week-numbering years to be subtracted.
22 * @param options - The options
23 *
24 * @returns The new date with the ISO week-numbering years subtracted
25 *
26 * @example
27 * // Subtract 5 ISO week-numbering years from 1 September 2014:
28 * const result = subISOWeekYears(new Date(2014, 8, 1), 5)
29 * //=> Mon Aug 31 2009 00:00:00
30 */
31export declare function subISOWeekYears<
32 DateType extends Date,
33 ResultDate extends Date = DateType,
34>(
35 date: DateArg<DateType>,
36 amount: number,
37 options?: SubISOWeekYearsOptions<ResultDate> | undefined,
38): ResultDate;