previousSunday.cjs 1018 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. exports.previousSunday = previousSunday;
  3. var _index = require("./previousDay.cjs");
  4. /**
  5. * The {@link previousSunday} function options.
  6. */
  7. /**
  8. * @name previousSunday
  9. * @category Weekday Helpers
  10. * @summary When is the previous Sunday?
  11. *
  12. * @description
  13. * When is the previous Sunday?
  14. *
  15. * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
  16. * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
  17. *
  18. * @param date - The date to start counting from
  19. * @param options - The options
  20. *
  21. * @returns The previous Sunday
  22. *
  23. * @example
  24. * // When is the previous Sunday before Jun, 21, 2021?
  25. * const result = previousSunday(new Date(2021, 5, 21))
  26. * //=> Sun June 20 2021 00:00:00
  27. */
  28. function previousSunday(date, options) {
  29. return (0, _index.previousDay)(date, 0, options);
  30. }