registration
This commit is contained in:
30
frontend/style/node_modules/date-fns/isWithinInterval.js
generated
vendored
30
frontend/style/node_modules/date-fns/isWithinInterval.js
generated
vendored
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
exports.isWithinInterval = isWithinInterval;
|
||||
var _index = require("./toDate.js");
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link isWithinInterval} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name isWithinInterval
|
||||
@@ -10,10 +12,9 @@ var _index = require("./toDate.js");
|
||||
* @description
|
||||
* Is the given date within the interval? (Including start and end.)
|
||||
*
|
||||
* @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).
|
||||
*
|
||||
* @param date - The date to check
|
||||
* @param interval - The interval to check
|
||||
* @param options - An object with options
|
||||
*
|
||||
* @returns The date is within the interval
|
||||
*
|
||||
@@ -23,7 +24,7 @@ var _index = require("./toDate.js");
|
||||
* start: new Date(2014, 0, 1),
|
||||
* end: new Date(2014, 0, 7)
|
||||
* })
|
||||
* //=> true
|
||||
* // => true
|
||||
*
|
||||
* @example
|
||||
* // For the date outside of the interval:
|
||||
@@ -31,24 +32,27 @@ var _index = require("./toDate.js");
|
||||
* start: new Date(2014, 0, 1),
|
||||
* end: new Date(2014, 0, 7)
|
||||
* })
|
||||
* //=> false
|
||||
* // => false
|
||||
*
|
||||
* @example
|
||||
* // For date equal to interval start:
|
||||
* // For date equal to the interval start:
|
||||
* isWithinInterval(date, { start, end: date })
|
||||
* // => true
|
||||
*
|
||||
* @example
|
||||
* // For date equal to interval end:
|
||||
* // For date equal to the interval end:
|
||||
* isWithinInterval(date, { start: date, end })
|
||||
* // => true
|
||||
*/
|
||||
function isWithinInterval(date, interval) {
|
||||
const time = +(0, _index.toDate)(date);
|
||||
export function isWithinInterval(date, interval, options) {
|
||||
const time = +toDate(date, options?.in);
|
||||
const [startTime, endTime] = [
|
||||
+(0, _index.toDate)(interval.start),
|
||||
+(0, _index.toDate)(interval.end),
|
||||
+toDate(interval.start, options?.in),
|
||||
+toDate(interval.end, options?.in),
|
||||
].sort((a, b) => a - b);
|
||||
|
||||
return time >= startTime && time <= endTime;
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default isWithinInterval;
|
||||
|
||||
Reference in New Issue
Block a user