index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isThisISOWeek;
  6. var _index = _interopRequireDefault(require("../isSameISOWeek/index.js"));
  7. var _index2 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. /**
  10. * @name isThisISOWeek
  11. * @category ISO Week Helpers
  12. * @summary Is the given date in the same ISO week as the current date?
  13. * @pure false
  14. *
  15. * @description
  16. * Is the given date in the same ISO week as the current date?
  17. *
  18. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  19. *
  20. * > ⚠️ Please note that this function is not present in the FP submodule as
  21. * > it uses `Date.now()` internally hence impure and can't be safely curried.
  22. *
  23. * ### v2.0.0 breaking changes:
  24. *
  25. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  26. *
  27. * @param {Date|Number} date - the date to check
  28. * @returns {Boolean} the date is in this ISO week
  29. * @throws {TypeError} 1 argument required
  30. *
  31. * @example
  32. * // If today is 25 September 2014, is 22 September 2014 in this ISO week?
  33. * var result = isThisISOWeek(new Date(2014, 8, 22))
  34. * //=> true
  35. */
  36. function isThisISOWeek(dirtyDate) {
  37. (0, _index2.default)(1, arguments);
  38. return (0, _index.default)(dirtyDate, Date.now());
  39. }
  40. module.exports = exports.default;