UNPKG

992 BJavaScriptView Raw
1import { lastDayOfWeek } from "./lastDayOfWeek.mjs";
2
3/**
4 * @name lastDayOfISOWeek
5 * @category ISO Week Helpers
6 * @summary Return the last day of an ISO week for the given date.
7 *
8 * @description
9 * Return the last day 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 * @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).
15 *
16 * @param date - The original date
17 *
18 * @returns The last day of an ISO week
19 *
20 * @example
21 * // The last day of an ISO week for 2 September 2014 11:55:00:
22 * const result = lastDayOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
23 * //=> Sun Sep 07 2014 00:00:00
24 */
25export function lastDayOfISOWeek(date) {
26 return lastDayOfWeek(date, { weekStartsOn: 1 });
27}
28
29// Fallback for modularized imports:
30export default lastDayOfISOWeek;