addISOWeekYears.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import type { ContextOptions, DateArg } from "./types.js";
  2. /**
  3. * The {@link addISOWeekYears} function options.
  4. */
  5. export interface AddISOWeekYearsOptions<DateType extends Date = Date>
  6. extends ContextOptions<DateType> {}
  7. /**
  8. * @name addISOWeekYears
  9. * @category ISO Week-Numbering Year Helpers
  10. * @summary Add the specified number of ISO week-numbering years to the given date.
  11. *
  12. * @description
  13. * Add the specified number of ISO week-numbering years to 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. *
  19. * @param date - The date to be changed
  20. * @param amount - The amount of ISO week-numbering years to be added.
  21. * @param options - An object with options
  22. *
  23. * @returns The new date with the ISO week-numbering years added
  24. *
  25. * @example
  26. * // Add 5 ISO week-numbering years to 2 July 2010:
  27. * const result = addISOWeekYears(new Date(2010, 6, 2), 5)
  28. * //=> Fri Jun 26 2015 00:00:00
  29. */
  30. export declare function addISOWeekYears<
  31. DateType extends Date,
  32. ResultDate extends Date = DateType,
  33. >(
  34. date: DateArg<DateType>,
  35. amount: number,
  36. options?: AddISOWeekYearsOptions<ResultDate> | undefined,
  37. ): ResultDate;