registration
This commit is contained in:
29
frontend/style/node_modules/date-fns/addDays.js
generated
vendored
29
frontend/style/node_modules/date-fns/addDays.js
generated
vendored
@@ -1,7 +1,9 @@
|
||||
"use strict";
|
||||
exports.addDays = addDays;
|
||||
var _index = require("./toDate.js");
|
||||
var _index2 = require("./constructFrom.js");
|
||||
import { constructFrom } from "./constructFrom.js";
|
||||
import { toDate } from "./toDate.js";
|
||||
|
||||
/**
|
||||
* The {@link addDays} function options.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @name addDays
|
||||
@@ -12,9 +14,11 @@ var _index2 = require("./constructFrom.js");
|
||||
* Add the specified number of days to the given date.
|
||||
*
|
||||
* @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 date - The date to be changed
|
||||
* @param amount - The amount of days to be added.
|
||||
* @param options - An object with options
|
||||
*
|
||||
* @returns The new date with the days added
|
||||
*
|
||||
@@ -23,13 +27,16 @@ var _index2 = require("./constructFrom.js");
|
||||
* const result = addDays(new Date(2014, 8, 1), 10)
|
||||
* //=> Thu Sep 11 2014 00:00:00
|
||||
*/
|
||||
function addDays(date, amount) {
|
||||
const _date = (0, _index.toDate)(date);
|
||||
if (isNaN(amount)) return (0, _index2.constructFrom)(date, NaN);
|
||||
if (!amount) {
|
||||
// If 0 days, no-op to avoid changing times in the hour before end of DST
|
||||
return _date;
|
||||
}
|
||||
export function addDays(date, amount, options) {
|
||||
const _date = toDate(date, options?.in);
|
||||
if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
|
||||
|
||||
// If 0 days, no-op to avoid changing times in the hour before end of DST
|
||||
if (!amount) return _date;
|
||||
|
||||
_date.setDate(_date.getDate() + amount);
|
||||
return _date;
|
||||
}
|
||||
|
||||
// Fallback for modularized imports:
|
||||
export default addDays;
|
||||
|
||||
Reference in New Issue
Block a user