index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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. * ### v2.0.0 breaking changes:
  15. *
  16. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  17. *
  18. * @param {Date|Number} date - the original date
  19. * @returns {Date} the end of an ISO week
  20. * @throws {TypeError} 1 argument required
  21. *
  22. * @example
  23. * // The end of an ISO week for 2 September 2014 11:55:00:
  24. * var result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
  25. * //=> Sun Sep 07 2014 23:59:59.999
  26. */
  27. export default function endOfISOWeek(dirtyDate) {
  28. requiredArgs(1, arguments);
  29. return endOfWeek(dirtyDate, {
  30. weekStartsOn: 1
  31. });
  32. }