isSameISOWeek.cjs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. exports.isSameISOWeek = isSameISOWeek;
  3. var _index = require("./isSameWeek.cjs");
  4. /**
  5. * The {@link isSameISOWeek} function options.
  6. */
  7. /**
  8. * @name isSameISOWeek
  9. * @category ISO Week Helpers
  10. * @summary Are the given dates in the same ISO week (and year)?
  11. *
  12. * @description
  13. * Are the given dates in the same ISO week (and year)?
  14. *
  15. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  16. *
  17. * @param laterDate - The first date to check
  18. * @param earlierDate - The second date to check
  19. * @param options - An object with options
  20. *
  21. * @returns The dates are in the same ISO week (and year)
  22. *
  23. * @example
  24. * // Are 1 September 2014 and 7 September 2014 in the same ISO week?
  25. * const result = isSameISOWeek(new Date(2014, 8, 1), new Date(2014, 8, 7))
  26. * //=> true
  27. *
  28. * @example
  29. * // Are 1 September 2014 and 1 September 2015 in the same ISO week?
  30. * const result = isSameISOWeek(new Date(2014, 8, 1), new Date(2015, 8, 1))
  31. * //=> false
  32. */
  33. function isSameISOWeek(laterDate, earlierDate, options) {
  34. return (0, _index.isSameWeek)(laterDate, earlierDate, {
  35. ...options,
  36. weekStartsOn: 1,
  37. });
  38. }