getDay.cjs 633 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.getDay = getDay;
  3. var _index = require("./toDate.cjs");
  4. /**
  5. * The {@link getDay} function options.
  6. */
  7. /**
  8. * @name getDay
  9. * @category Weekday Helpers
  10. * @summary Get the day of the week of the given date.
  11. *
  12. * @description
  13. * Get the day of the week of the given date.
  14. *
  15. * @param date - The given date
  16. * @param options - The options
  17. *
  18. * @returns The day of week, 0 represents Sunday
  19. *
  20. * @example
  21. * // Which day of the week is 29 February 2012?
  22. * const result = getDay(new Date(2012, 1, 29))
  23. * //=> 3
  24. */
  25. function getDay(date, options) {
  26. return (0, _index.toDate)(date, options?.in).getDay();
  27. }