index.js 985 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = previousThursday;
  7. var _index = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  8. var _index2 = _interopRequireDefault(require("../previousDay/index.js"));
  9. /**
  10. * @name previousThursday
  11. * @category Weekday Helpers
  12. * @summary When is the previous Thursday?
  13. *
  14. * @description
  15. * When is the previous Thursday?
  16. *
  17. * @param {Date | number} date - the date to start counting from
  18. * @returns {Date} the previous Thursday
  19. * @throws {TypeError} 1 argument required
  20. *
  21. * @example
  22. * // When is the previous Thursday before Jun, 18, 2021?
  23. * const result = previousThursday(new Date(2021, 5, 18))
  24. * //=> Thu June 17 2021 00:00:00
  25. */
  26. function previousThursday(date) {
  27. (0, _index.default)(1, arguments);
  28. return (0, _index2.default)(date, 4);
  29. }
  30. module.exports = exports.default;