isThisQuarter.cjs 942 B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. exports.isThisQuarter = isThisQuarter;
  3. var _index = require("./constructFrom.cjs");
  4. var _index2 = require("./constructNow.cjs");
  5. var _index3 = require("./isSameQuarter.cjs");
  6. /**
  7. * The {@link isThisQuarter} function options.
  8. */
  9. /**
  10. * @name isThisQuarter
  11. * @category Quarter Helpers
  12. * @summary Is the given date in the same quarter as the current date?
  13. * @pure false
  14. *
  15. * @description
  16. * Is the given date in the same quarter as the current date?
  17. *
  18. * @param date - The date to check
  19. * @param options - An object with options
  20. *
  21. * @returns The date is in this quarter
  22. *
  23. * @example
  24. * // If today is 25 September 2014, is 2 July 2014 in this quarter?
  25. * const result = isThisQuarter(new Date(2014, 6, 2))
  26. * //=> true
  27. */
  28. function isThisQuarter(date, options) {
  29. return (0, _index3.isSameQuarter)(
  30. (0, _index.constructFrom)(options?.in || date, date),
  31. (0, _index2.constructNow)(options?.in || date),
  32. );
  33. }