UNPKG

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