1 | ;
|
2 | exports.addISOWeekYears = addISOWeekYears;
|
3 | var _index = require("./getISOWeekYear.js");
|
4 | var _index2 = require("./setISOWeekYear.js");
|
5 |
|
6 | /**
|
7 | * @name addISOWeekYears
|
8 | * @category ISO Week-Numbering Year Helpers
|
9 | * @summary Add the specified number of ISO week-numbering years to the given date.
|
10 | *
|
11 | * @description
|
12 | * Add the specified number of ISO week-numbering years to the given date.
|
13 | *
|
14 | * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
15 | *
|
16 | * @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).
|
17 | *
|
18 | * @param date - The date to be changed
|
19 | * @param amount - The amount of ISO week-numbering years to be added.
|
20 | *
|
21 | * @returns The new date with the ISO week-numbering years added
|
22 | *
|
23 | * @example
|
24 | * // Add 5 ISO week-numbering years to 2 July 2010:
|
25 | * const result = addISOWeekYears(new Date(2010, 6, 2), 5)
|
26 | * //=> Fri Jn 26 2015 00:00:00
|
27 | */
|
28 | function addISOWeekYears(date, amount) {
|
29 | return (0, _index2.setISOWeekYear)(
|
30 | date,
|
31 | (0, _index.getISOWeekYear)(date) + amount,
|
32 | );
|
33 | }
|