index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = isThisISOWeek;
  7. var _index = _interopRequireDefault(require("../isSameISOWeek/index.js"));
  8. var _index2 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  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. * @param {Date|Number} date - the date to check
  24. * @returns {Boolean} the date is in this ISO week
  25. * @throws {TypeError} 1 argument required
  26. *
  27. * @example
  28. * // If today is 25 September 2014, is 22 September 2014 in this ISO week?
  29. * const result = isThisISOWeek(new Date(2014, 8, 22))
  30. * //=> true
  31. */
  32. function isThisISOWeek(dirtyDate) {
  33. (0, _index2.default)(1, arguments);
  34. return (0, _index.default)(dirtyDate, Date.now());
  35. }
  36. module.exports = exports.default;