isThisISOWeek.cjs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. exports.isThisISOWeek = isThisISOWeek;
  3. var _index = require("./constructFrom.cjs");
  4. var _index2 = require("./constructNow.cjs");
  5. var _index3 = require("./isSameISOWeek.cjs");
  6. /**
  7. * The {@link isThisISOWeek} function options.
  8. */
  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. * @param date - The date to check
  21. * @param options - An object with options
  22. *
  23. * @returns The date is in this ISO week
  24. *
  25. * @example
  26. * // If today is 25 September 2014, is 22 September 2014 in this ISO week?
  27. * const result = isThisISOWeek(new Date(2014, 8, 22))
  28. * //=> true
  29. */
  30. function isThisISOWeek(date, options) {
  31. return (0, _index3.isSameISOWeek)(
  32. (0, _index.constructFrom)(options?.in || date, date),
  33. (0, _index2.constructNow)(options?.in || date),
  34. );
  35. }