index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import isSameWeek from "../isSameWeek/index.js";
  2. import requiredArgs from "../_lib/requiredArgs/index.js";
  3. /**
  4. * @name isSameISOWeek
  5. * @category ISO Week Helpers
  6. * @summary Are the given dates in the same ISO week?
  7. *
  8. * @description
  9. * Are the given dates in the same ISO week?
  10. *
  11. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  12. *
  13. * ### v2.0.0 breaking changes:
  14. *
  15. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  16. *
  17. * @param {Date|Number} dateLeft - the first date to check
  18. * @param {Date|Number} dateRight - the second date to check
  19. * @returns {Boolean} the dates are in the same ISO week
  20. * @throws {TypeError} 2 arguments required
  21. *
  22. * @example
  23. * // Are 1 September 2014 and 7 September 2014 in the same ISO week?
  24. * var result = isSameISOWeek(new Date(2014, 8, 1), new Date(2014, 8, 7))
  25. * //=> true
  26. */
  27. export default function isSameISOWeek(dirtyDateLeft, dirtyDateRight) {
  28. requiredArgs(2, arguments);
  29. return isSameWeek(dirtyDateLeft, dirtyDateRight, {
  30. weekStartsOn: 1
  31. });
  32. }