registration
This commit is contained in:
25
frontend/style/node_modules/date-fns/interval.js
generated
vendored
25
frontend/style/node_modules/date-fns/interval.js
generated
vendored
@@ -1,11 +1,16 @@
|
||||
"use strict";
|
||||
exports.interval = interval;
|
||||
var _index = require("./toDate.js");
|
||||
import { normalizeDates } from "./_lib/normalizeDates.js";
|
||||
|
||||
/**
|
||||
* The {@link interval} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The {@link interval} function result type. It resolves the proper data type.
|
||||
* It uses the first argument date object type, starting from the start argument,
|
||||
* then the end interval date. If a context function is passed, it uses the context
|
||||
* function return type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name interval
|
||||
* @category Interval Helpers
|
||||
@@ -14,7 +19,9 @@ var _index = require("./toDate.js");
|
||||
* @description
|
||||
* Creates a normalized interval object and validates its values. If the interval is invalid, an exception is thrown.
|
||||
*
|
||||
* @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).
|
||||
* @typeParam StartDate - Start date type.
|
||||
* @typeParam EndDate - End date type.
|
||||
* @typeParam Options - Options type.
|
||||
*
|
||||
* @param start - The start of the interval.
|
||||
* @param end - The end of the interval.
|
||||
@@ -26,11 +33,10 @@ var _index = require("./toDate.js");
|
||||
*
|
||||
* @returns The normalized and validated interval object.
|
||||
*/
|
||||
function interval(start, end, options) {
|
||||
const _start = (0, _index.toDate)(start);
|
||||
if (isNaN(+_start)) throw new TypeError("Start date is invalid");
|
||||
export function interval(start, end, options) {
|
||||
const [_start, _end] = normalizeDates(options?.in, start, end);
|
||||
|
||||
const _end = (0, _index.toDate)(end);
|
||||
if (isNaN(+_start)) throw new TypeError("Start date is invalid");
|
||||
if (isNaN(+_end)) throw new TypeError("End date is invalid");
|
||||
|
||||
if (options?.assertPositive && +_start > +_end)
|
||||
@@ -38,3 +44,6 @@ function interval(start, end, options) {
|
||||
|
||||
return { start: _start, end: _end };
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default interval;
|
||||
|
||||
Reference in New Issue
Block a user