lastDayOfISOWeek.mjs 992 B

123456789101112131415161718192021222324252627282930
  1. import { lastDayOfWeek } from "./lastDayOfWeek.mjs";
  2. /**
  3. * @name lastDayOfISOWeek
  4. * @category ISO Week Helpers
  5. * @summary Return the last day of an ISO week for the given date.
  6. *
  7. * @description
  8. * Return the last day of an ISO week for the given date.
  9. * The result will be in the local timezone.
  10. *
  11. * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
  12. *
  13. * @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).
  14. *
  15. * @param date - The original date
  16. *
  17. * @returns The last day of an ISO week
  18. *
  19. * @example
  20. * // The last day of an ISO week for 2 September 2014 11:55:00:
  21. * const result = lastDayOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
  22. * //=> Sun Sep 07 2014 00:00:00
  23. */
  24. export function lastDayOfISOWeek(date) {
  25. return lastDayOfWeek(date, { weekStartsOn: 1 });
  26. }
  27. // Fallback for modularized imports:
  28. export default lastDayOfISOWeek;