registration
This commit is contained in:
30
frontend/style/node_modules/date-fns/min.js
generated
vendored
30
frontend/style/node_modules/date-fns/min.js
generated
vendored
@@ -1,6 +1,9 @@
|
||||
"use strict";
|
||||
exports.min = min;
|
||||
var _index = require("./toDate.js");
|
||||
import { constructFrom } from "./constructFrom.js";
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link min} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name min
|
||||
@@ -11,6 +14,7 @@ var _index = require("./toDate.js");
|
||||
* Returns the earliest of the given dates.
|
||||
*
|
||||
* @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 ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
||||
*
|
||||
* @param dates - The dates to compare
|
||||
*
|
||||
@@ -26,15 +30,21 @@ var _index = require("./toDate.js");
|
||||
* ])
|
||||
* //=> Wed Feb 11 1987 00:00:00
|
||||
*/
|
||||
function min(dates) {
|
||||
export function min(dates, options) {
|
||||
let result;
|
||||
let context = options?.in;
|
||||
|
||||
dates.forEach((dirtyDate) => {
|
||||
const date = (0, _index.toDate)(dirtyDate);
|
||||
if (!result || result > date || isNaN(+date)) {
|
||||
result = date;
|
||||
}
|
||||
dates.forEach((date) => {
|
||||
// Use the first date object as the context function
|
||||
if (!context && typeof date === "object")
|
||||
context = constructFrom.bind(null, date);
|
||||
|
||||
const date_ = toDate(date, context);
|
||||
if (!result || result > date_ || isNaN(+date_)) result = date_;
|
||||
});
|
||||
|
||||
return result || new Date(NaN);
|
||||
return constructFrom(context, result || NaN);
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default min;
|
||||
|
||||
Reference in New Issue
Block a user