aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/date-fns/esm/isWithinInterval/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/date-fns/esm/isWithinInterval/index.js')
-rw-r--r--node_modules/date-fns/esm/isWithinInterval/index.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/node_modules/date-fns/esm/isWithinInterval/index.js b/node_modules/date-fns/esm/isWithinInterval/index.js
deleted file mode 100644
index f8fd012..0000000
--- a/node_modules/date-fns/esm/isWithinInterval/index.js
+++ /dev/null
@@ -1,53 +0,0 @@
-import toDate from "../toDate/index.js";
-import requiredArgs from "../_lib/requiredArgs/index.js";
-/**
- * @name isWithinInterval
- * @category Interval Helpers
- * @summary Is the given date within the interval?
- *
- * @description
- * Is the given date within the interval? (Including start and end.)
- *
- * @param {Date|Number} date - the date to check
- * @param {Interval} interval - the interval to check
- * @returns {Boolean} the date is within the interval
- * @throws {TypeError} 2 arguments required
- * @throws {RangeError} The start of an interval cannot be after its end
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
- *
- * @example
- * // For the date within the interval:
- * isWithinInterval(new Date(2014, 0, 3), {
- * start: new Date(2014, 0, 1),
- * end: new Date(2014, 0, 7)
- * })
- * //=> true
- *
- * @example
- * // For the date outside of the interval:
- * isWithinInterval(new Date(2014, 0, 10), {
- * start: new Date(2014, 0, 1),
- * end: new Date(2014, 0, 7)
- * })
- * //=> false
- *
- * @example
- * // For date equal to interval start:
- * isWithinInterval(date, { start, end: date }) // => true
- *
- * @example
- * // For date equal to interval end:
- * isWithinInterval(date, { start: date, end }) // => true
- */
-export default function isWithinInterval(dirtyDate, interval) {
- requiredArgs(2, arguments);
- var time = toDate(dirtyDate).getTime();
- var startTime = toDate(interval.start).getTime();
- var endTime = toDate(interval.end).getTime();
-
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
- if (!(startTime <= endTime)) {
- throw new RangeError('Invalid interval');
- }
- return time >= startTime && time <= endTime;
-} \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage