index.js 870 B

12345678910111213141516171819202122232425262728
  1. import endOfWeek from "../endOfWeek/index.js";
  2. import requiredArgs from "../_lib/requiredArgs/index.js";
  3. /**
  4. * @name endOfISOWeek
  5. * @category ISO Week Helpers
  6. * @summary Return the end of an ISO week for the given date.
  7. *
  8. * @description
  9. * Return the end of an ISO week for the given date.
  10. * The result will be in the local timezone.
  11. *
  12. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  13. *
  14. * @param {Date|Number} date - the original date
  15. * @returns {Date} the end of an ISO week
  16. * @throws {TypeError} 1 argument required
  17. *
  18. * @example
  19. * // The end of an ISO week for 2 September 2014 11:55:00:
  20. * const result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
  21. * //=> Sun Sep 07 2014 23:59:59.999
  22. */
  23. export default function endOfISOWeek(dirtyDate) {
  24. requiredArgs(1, arguments);
  25. return endOfWeek(dirtyDate, {
  26. weekStartsOn: 1
  27. });
  28. }