endOfISOWeek.js 932 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.endOfISOWeek = endOfISOWeek;
  3. var _index = require("./endOfWeek.js");
  4. /**
  5. * @name endOfISOWeek
  6. * @category ISO Week Helpers
  7. * @summary Return the end of an ISO week for the given date.
  8. *
  9. * @description
  10. * Return the end of an ISO week for the given date.
  11. * The result will be in the local timezone.
  12. *
  13. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  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. *
  17. * @param date - The original date
  18. *
  19. * @returns The end of an ISO week
  20. *
  21. * @example
  22. * // The end of an ISO week for 2 September 2014 11:55:00:
  23. * const result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
  24. * //=> Sun Sep 07 2014 23:59:59.999
  25. */
  26. function endOfISOWeek(date) {
  27. return (0, _index.endOfWeek)(date, { weekStartsOn: 1 });
  28. }