subISOWeekYears.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.subISOWeekYears = subISOWeekYears;
  3. var _index = require("./addISOWeekYears.js");
  4. /**
  5. * @name subISOWeekYears
  6. * @category ISO Week-Numbering Year Helpers
  7. * @summary Subtract the specified number of ISO week-numbering years from the given date.
  8. *
  9. * @description
  10. * Subtract the specified number of ISO week-numbering years from the given date.
  11. *
  12. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  13. *
  14. * @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).
  15. *
  16. * @param date - The date to be changed
  17. * @param amount - The amount of ISO week-numbering years to be subtracted.
  18. *
  19. * @returns The new date with the ISO week-numbering years subtracted
  20. *
  21. * @example
  22. * // Subtract 5 ISO week-numbering years from 1 September 2014:
  23. * const result = subISOWeekYears(new Date(2014, 8, 1), 5)
  24. * //=> Mon Aug 31 2009 00:00:00
  25. */
  26. function subISOWeekYears(date, amount) {
  27. return (0, _index.addISOWeekYears)(date, -amount);
  28. }