index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = isSameISOWeek;
  6. var _index = _interopRequireDefault(require("../isSameWeek/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 isSameISOWeek
  11. * @category ISO Week Helpers
  12. * @summary Are the given dates in the same ISO week?
  13. *
  14. * @description
  15. * Are the given dates in the same ISO week?
  16. *
  17. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  18. *
  19. * ### v2.0.0 breaking changes:
  20. *
  21. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  22. *
  23. * @param {Date|Number} dateLeft - the first date to check
  24. * @param {Date|Number} dateRight - the second date to check
  25. * @returns {Boolean} the dates are in the same ISO week
  26. * @throws {TypeError} 2 arguments required
  27. *
  28. * @example
  29. * // Are 1 September 2014 and 7 September 2014 in the same ISO week?
  30. * var result = isSameISOWeek(new Date(2014, 8, 1), new Date(2014, 8, 7))
  31. * //=> true
  32. */
  33. function isSameISOWeek(dirtyDateLeft, dirtyDateRight) {
  34. (0, _index2.default)(2, arguments);
  35. return (0, _index.default)(dirtyDateLeft, dirtyDateRight, {
  36. weekStartsOn: 1
  37. });
  38. }
  39. module.exports = exports.default;