index.js 922 B

1234567891011121314151617181920212223242526
  1. var addISOYears = require('../add_iso_years/index.js')
  2. /**
  3. * @category ISO Week-Numbering Year Helpers
  4. * @summary Subtract the specified number of ISO week-numbering years from the given date.
  5. *
  6. * @description
  7. * Subtract the specified number of ISO week-numbering years from the given date.
  8. *
  9. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  10. *
  11. * @param {Date|String|Number} date - the date to be changed
  12. * @param {Number} amount - the amount of ISO week-numbering years to be subtracted
  13. * @returns {Date} the new date with the ISO week-numbering years subtracted
  14. *
  15. * @example
  16. * // Subtract 5 ISO week-numbering years from 1 September 2014:
  17. * var result = subISOYears(new Date(2014, 8, 1), 5)
  18. * //=> Mon Aug 31 2009 00:00:00
  19. */
  20. function subISOYears (dirtyDate, dirtyAmount) {
  21. var amount = Number(dirtyAmount)
  22. return addISOYears(dirtyDate, -amount)
  23. }
  24. module.exports = subISOYears