UNPKG

1.37 kBJavaScriptView Raw
1import { addISOWeekYears } from "./addISOWeekYears.js";
2
3/**
4 * The {@link subISOWeekYears} function options.
5 */
6
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 function subISOWeekYears(date, amount, options) {
32 return addISOWeekYears(date, -amount, options);
33}
34
35// Fallback for modularized imports:
36export default subISOWeekYears;