isThisISOWeek.js 980 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. exports.isThisISOWeek = isThisISOWeek;
  3. var _index = require("./constructNow.js");
  4. var _index2 = require("./isSameISOWeek.js");
  5. /**
  6. * @name isThisISOWeek
  7. * @category ISO Week Helpers
  8. * @summary Is the given date in the same ISO week as the current date?
  9. * @pure false
  10. *
  11. * @description
  12. * Is the given date in the same ISO week as the current 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 check
  19. *
  20. * @returns The date is in this ISO week
  21. *
  22. * @example
  23. * // If today is 25 September 2014, is 22 September 2014 in this ISO week?
  24. * const result = isThisISOWeek(new Date(2014, 8, 22))
  25. * //=> true
  26. */
  27. function isThisISOWeek(date) {
  28. return (0, _index2.isSameISOWeek)(date, (0, _index.constructNow)(date));
  29. }