aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/date-fns/esm/eachWeekOfInterval
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-06-28 17:26:46 -0700
committerPinapelz <yukais@pinapelz.com>2025-06-28 17:43:56 -0700
commite4fa1e69e7ebfb627c7198fd1a9881e9327ec4d4 (patch)
tree06284a538a6008eca75051399e47db4e5d50301c /node_modules/date-fns/esm/eachWeekOfInterval
initial commit: scaffolding
Diffstat (limited to 'node_modules/date-fns/esm/eachWeekOfInterval')
-rw-r--r--node_modules/date-fns/esm/eachWeekOfInterval/index.d.ts4
-rw-r--r--node_modules/date-fns/esm/eachWeekOfInterval/index.js67
-rw-r--r--node_modules/date-fns/esm/eachWeekOfInterval/index.js.flow58
-rw-r--r--node_modules/date-fns/esm/eachWeekOfInterval/package.json4
4 files changed, 133 insertions, 0 deletions
diff --git a/node_modules/date-fns/esm/eachWeekOfInterval/index.d.ts b/node_modules/date-fns/esm/eachWeekOfInterval/index.d.ts
new file mode 100644
index 0000000..24d1a8a
--- /dev/null
+++ b/node_modules/date-fns/esm/eachWeekOfInterval/index.d.ts
@@ -0,0 +1,4 @@
+// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
+
+import { eachWeekOfInterval } from 'date-fns'
+export default eachWeekOfInterval
diff --git a/node_modules/date-fns/esm/eachWeekOfInterval/index.js b/node_modules/date-fns/esm/eachWeekOfInterval/index.js
new file mode 100644
index 0000000..86359f0
--- /dev/null
+++ b/node_modules/date-fns/esm/eachWeekOfInterval/index.js
@@ -0,0 +1,67 @@
+import addWeeks from "../addWeeks/index.js";
+import startOfWeek from "../startOfWeek/index.js";
+import toDate from "../toDate/index.js";
+import requiredArgs from "../_lib/requiredArgs/index.js";
+/**
+ * @name eachWeekOfInterval
+ * @category Interval Helpers
+ * @summary Return the array of weeks within the specified time interval.
+ *
+ * @description
+ * Return the array of weeks within the specified time interval.
+ *
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
+ * @param {Object} [options] - an object with options.
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
+ * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end
+ * @throws {TypeError} 1 argument required
+ * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6
+ * @throws {RangeError} The start of an interval cannot be after its end
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
+ *
+ * @example
+ * // Each week within interval 6 October 2014 - 23 November 2014:
+ * const result = eachWeekOfInterval({
+ * start: new Date(2014, 9, 6),
+ * end: new Date(2014, 10, 23)
+ * })
+ * //=> [
+ * // Sun Oct 05 2014 00:00:00,
+ * // Sun Oct 12 2014 00:00:00,
+ * // Sun Oct 19 2014 00:00:00,
+ * // Sun Oct 26 2014 00:00:00,
+ * // Sun Nov 02 2014 00:00:00,
+ * // Sun Nov 09 2014 00:00:00,
+ * // Sun Nov 16 2014 00:00:00,
+ * // Sun Nov 23 2014 00:00:00
+ * // ]
+ */
+export default function eachWeekOfInterval(dirtyInterval, options) {
+ requiredArgs(1, arguments);
+ var interval = dirtyInterval || {};
+ var startDate = toDate(interval.start);
+ var endDate = toDate(interval.end);
+ var endTime = endDate.getTime();
+
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
+ if (!(startDate.getTime() <= endTime)) {
+ throw new RangeError('Invalid interval');
+ }
+ var startDateWeek = startOfWeek(startDate, options);
+ var endDateWeek = startOfWeek(endDate, options);
+
+ // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet
+ startDateWeek.setHours(15);
+ endDateWeek.setHours(15);
+ endTime = endDateWeek.getTime();
+ var weeks = [];
+ var currentWeek = startDateWeek;
+ while (currentWeek.getTime() <= endTime) {
+ currentWeek.setHours(0);
+ weeks.push(toDate(currentWeek));
+ currentWeek = addWeeks(currentWeek, 1);
+ currentWeek.setHours(15);
+ }
+ return weeks;
+} \ No newline at end of file
diff --git a/node_modules/date-fns/esm/eachWeekOfInterval/index.js.flow b/node_modules/date-fns/esm/eachWeekOfInterval/index.js.flow
new file mode 100644
index 0000000..bc8cd5a
--- /dev/null
+++ b/node_modules/date-fns/esm/eachWeekOfInterval/index.js.flow
@@ -0,0 +1,58 @@
+// @flow
+// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it.
+
+export type Interval = {
+ start: Date | number,
+ end: Date | number,
+}
+
+export type Locale = {
+ code?: string,
+ formatDistance?: (...args: Array<any>) => any,
+ formatRelative?: (...args: Array<any>) => any,
+ localize?: {
+ ordinalNumber: (...args: Array<any>) => any,
+ era: (...args: Array<any>) => any,
+ quarter: (...args: Array<any>) => any,
+ month: (...args: Array<any>) => any,
+ day: (...args: Array<any>) => any,
+ dayPeriod: (...args: Array<any>) => any,
+ },
+ formatLong?: {
+ date: (...args: Array<any>) => any,
+ time: (...args: Array<any>) => any,
+ dateTime: (...args: Array<any>) => any,
+ },
+ match?: {
+ ordinalNumber: (...args: Array<any>) => any,
+ era: (...args: Array<any>) => any,
+ quarter: (...args: Array<any>) => any,
+ month: (...args: Array<any>) => any,
+ day: (...args: Array<any>) => any,
+ dayPeriod: (...args: Array<any>) => any,
+ },
+ options?: {
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
+ firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
+ },
+}
+
+export type Duration = {
+ years?: number,
+ months?: number,
+ weeks?: number,
+ days?: number,
+ hours?: number,
+ minutes?: number,
+ seconds?: number,
+}
+
+export type Day = 0 | 1 | 2 | 3 | 4 | 5 | 6
+
+declare module.exports: (
+ interval: Interval,
+ options?: {
+ locale?: Locale,
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
+ }
+) => Date[]
diff --git a/node_modules/date-fns/esm/eachWeekOfInterval/package.json b/node_modules/date-fns/esm/eachWeekOfInterval/package.json
new file mode 100644
index 0000000..b109f05
--- /dev/null
+++ b/node_modules/date-fns/esm/eachWeekOfInterval/package.json
@@ -0,0 +1,4 @@
+{
+ "sideEffects": false,
+ "typings": "../../typings.d.ts"
+} \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage