subISOWeekYears.cjs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. exports.subISOWeekYears = subISOWeekYears;
  3. var _index = require("./addISOWeekYears.cjs");
  4. /**
  5. * The {@link subISOWeekYears} function options.
  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. */
  31. function subISOWeekYears(date, amount, options) {
  32. return (0, _index.addISOWeekYears)(date, -amount, options);
  33. }