Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: components.js
*
[52500] Fix | Delete
* @param date - The date that should be before the other one to return true
[52501] Fix | Delete
* @param dateToCompare - The date to compare with
[52502] Fix | Delete
*
[52503] Fix | Delete
* @returns The first date is before the second date
[52504] Fix | Delete
*
[52505] Fix | Delete
* @example
[52506] Fix | Delete
* // Is 10 July 1989 before 11 February 1987?
[52507] Fix | Delete
* const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
[52508] Fix | Delete
* //=> false
[52509] Fix | Delete
*/
[52510] Fix | Delete
function isBefore(date, dateToCompare) {
[52511] Fix | Delete
const _date = toDate(date);
[52512] Fix | Delete
const _dateToCompare = toDate(dateToCompare);
[52513] Fix | Delete
return +_date < +_dateToCompare;
[52514] Fix | Delete
}
[52515] Fix | Delete
[52516] Fix | Delete
/**
[52517] Fix | Delete
* @name isEqual
[52518] Fix | Delete
* @category Common Helpers
[52519] Fix | Delete
* @summary Are the given dates equal?
[52520] Fix | Delete
*
[52521] Fix | Delete
* @description
[52522] Fix | Delete
* Are the given dates equal?
[52523] Fix | Delete
*
[52524] Fix | Delete
* @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).
[52525] Fix | Delete
*
[52526] Fix | Delete
* @param dateLeft - The first date to compare
[52527] Fix | Delete
* @param dateRight - The second date to compare
[52528] Fix | Delete
*
[52529] Fix | Delete
* @returns The dates are equal
[52530] Fix | Delete
*
[52531] Fix | Delete
* @example
[52532] Fix | Delete
* // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
[52533] Fix | Delete
* const result = isEqual(
[52534] Fix | Delete
* new Date(2014, 6, 2, 6, 30, 45, 0),
[52535] Fix | Delete
* new Date(2014, 6, 2, 6, 30, 45, 500)
[52536] Fix | Delete
* )
[52537] Fix | Delete
* //=> false
[52538] Fix | Delete
*/
[52539] Fix | Delete
function isEqual(leftDate, rightDate) {
[52540] Fix | Delete
const _dateLeft = toDate(leftDate);
[52541] Fix | Delete
const _dateRight = toDate(rightDate);
[52542] Fix | Delete
return +_dateLeft === +_dateRight;
[52543] Fix | Delete
}
[52544] Fix | Delete
[52545] Fix | Delete
/**
[52546] Fix | Delete
* @name setMonth
[52547] Fix | Delete
* @category Month Helpers
[52548] Fix | Delete
* @summary Set the month to the given date.
[52549] Fix | Delete
*
[52550] Fix | Delete
* @description
[52551] Fix | Delete
* Set the month to the given date.
[52552] Fix | Delete
*
[52553] Fix | Delete
* @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).
[52554] Fix | Delete
*
[52555] Fix | Delete
* @param date - The date to be changed
[52556] Fix | Delete
* @param month - The month index to set (0-11)
[52557] Fix | Delete
*
[52558] Fix | Delete
* @returns The new date with the month set
[52559] Fix | Delete
*
[52560] Fix | Delete
* @example
[52561] Fix | Delete
* // Set February to 1 September 2014:
[52562] Fix | Delete
* const result = setMonth(new Date(2014, 8, 1), 1)
[52563] Fix | Delete
* //=> Sat Feb 01 2014 00:00:00
[52564] Fix | Delete
*/
[52565] Fix | Delete
function setMonth(date, month) {
[52566] Fix | Delete
const _date = toDate(date);
[52567] Fix | Delete
const year = _date.getFullYear();
[52568] Fix | Delete
const day = _date.getDate();
[52569] Fix | Delete
[52570] Fix | Delete
const dateWithDesiredMonth = constructFrom(date, 0);
[52571] Fix | Delete
dateWithDesiredMonth.setFullYear(year, month, 15);
[52572] Fix | Delete
dateWithDesiredMonth.setHours(0, 0, 0, 0);
[52573] Fix | Delete
const daysInMonth = getDaysInMonth(dateWithDesiredMonth);
[52574] Fix | Delete
// Set the last day of the new month
[52575] Fix | Delete
// if the original date was the last day of the longer month
[52576] Fix | Delete
_date.setMonth(month, Math.min(day, daysInMonth));
[52577] Fix | Delete
return _date;
[52578] Fix | Delete
}
[52579] Fix | Delete
[52580] Fix | Delete
/**
[52581] Fix | Delete
* @name set
[52582] Fix | Delete
* @category Common Helpers
[52583] Fix | Delete
* @summary Set date values to a given date.
[52584] Fix | Delete
*
[52585] Fix | Delete
* @description
[52586] Fix | Delete
* Set date values to a given date.
[52587] Fix | Delete
*
[52588] Fix | Delete
* Sets time values to date from object `values`.
[52589] Fix | Delete
* A value is not set if it is undefined or null or doesn't exist in `values`.
[52590] Fix | Delete
*
[52591] Fix | Delete
* Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
[52592] Fix | Delete
* to use native `Date#setX` methods. If you use this function, you may not want to include the
[52593] Fix | Delete
* other `setX` functions that date-fns provides if you are concerned about the bundle size.
[52594] Fix | Delete
*
[52595] Fix | Delete
* @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).
[52596] Fix | Delete
*
[52597] Fix | Delete
* @param date - The date to be changed
[52598] Fix | Delete
* @param values - The date values to be set
[52599] Fix | Delete
*
[52600] Fix | Delete
* @returns The new date with options set
[52601] Fix | Delete
*
[52602] Fix | Delete
* @example
[52603] Fix | Delete
* // Transform 1 September 2014 into 20 October 2015 in a single line:
[52604] Fix | Delete
* const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
[52605] Fix | Delete
* //=> Tue Oct 20 2015 00:00:00
[52606] Fix | Delete
*
[52607] Fix | Delete
* @example
[52608] Fix | Delete
* // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
[52609] Fix | Delete
* const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
[52610] Fix | Delete
* //=> Mon Sep 01 2014 12:23:45
[52611] Fix | Delete
*/
[52612] Fix | Delete
[52613] Fix | Delete
function set(date, values) {
[52614] Fix | Delete
let _date = toDate(date);
[52615] Fix | Delete
[52616] Fix | Delete
// Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
[52617] Fix | Delete
if (isNaN(+_date)) {
[52618] Fix | Delete
return constructFrom(date, NaN);
[52619] Fix | Delete
}
[52620] Fix | Delete
[52621] Fix | Delete
if (values.year != null) {
[52622] Fix | Delete
_date.setFullYear(values.year);
[52623] Fix | Delete
}
[52624] Fix | Delete
[52625] Fix | Delete
if (values.month != null) {
[52626] Fix | Delete
_date = setMonth(_date, values.month);
[52627] Fix | Delete
}
[52628] Fix | Delete
[52629] Fix | Delete
if (values.date != null) {
[52630] Fix | Delete
_date.setDate(values.date);
[52631] Fix | Delete
}
[52632] Fix | Delete
[52633] Fix | Delete
if (values.hours != null) {
[52634] Fix | Delete
_date.setHours(values.hours);
[52635] Fix | Delete
}
[52636] Fix | Delete
[52637] Fix | Delete
if (values.minutes != null) {
[52638] Fix | Delete
_date.setMinutes(values.minutes);
[52639] Fix | Delete
}
[52640] Fix | Delete
[52641] Fix | Delete
if (values.seconds != null) {
[52642] Fix | Delete
_date.setSeconds(values.seconds);
[52643] Fix | Delete
}
[52644] Fix | Delete
[52645] Fix | Delete
if (values.milliseconds != null) {
[52646] Fix | Delete
_date.setMilliseconds(values.milliseconds);
[52647] Fix | Delete
}
[52648] Fix | Delete
[52649] Fix | Delete
return _date;
[52650] Fix | Delete
}
[52651] Fix | Delete
[52652] Fix | Delete
/**
[52653] Fix | Delete
* @name setYear
[52654] Fix | Delete
* @category Year Helpers
[52655] Fix | Delete
* @summary Set the year to the given date.
[52656] Fix | Delete
*
[52657] Fix | Delete
* @description
[52658] Fix | Delete
* Set the year to the given date.
[52659] Fix | Delete
*
[52660] Fix | Delete
* @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).
[52661] Fix | Delete
*
[52662] Fix | Delete
* @param date - The date to be changed
[52663] Fix | Delete
* @param year - The year of the new date
[52664] Fix | Delete
*
[52665] Fix | Delete
* @returns The new date with the year set
[52666] Fix | Delete
*
[52667] Fix | Delete
* @example
[52668] Fix | Delete
* // Set year 2013 to 1 September 2014:
[52669] Fix | Delete
* const result = setYear(new Date(2014, 8, 1), 2013)
[52670] Fix | Delete
* //=> Sun Sep 01 2013 00:00:00
[52671] Fix | Delete
*/
[52672] Fix | Delete
function setYear(date, year) {
[52673] Fix | Delete
const _date = toDate(date);
[52674] Fix | Delete
[52675] Fix | Delete
// Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
[52676] Fix | Delete
if (isNaN(+_date)) {
[52677] Fix | Delete
return constructFrom(date, NaN);
[52678] Fix | Delete
}
[52679] Fix | Delete
[52680] Fix | Delete
_date.setFullYear(year);
[52681] Fix | Delete
return _date;
[52682] Fix | Delete
}
[52683] Fix | Delete
[52684] Fix | Delete
/**
[52685] Fix | Delete
* @name startOfToday
[52686] Fix | Delete
* @category Day Helpers
[52687] Fix | Delete
* @summary Return the start of today.
[52688] Fix | Delete
* @pure false
[52689] Fix | Delete
*
[52690] Fix | Delete
* @description
[52691] Fix | Delete
* Return the start of today.
[52692] Fix | Delete
*
[52693] Fix | Delete
* @returns The start of today
[52694] Fix | Delete
*
[52695] Fix | Delete
* @example
[52696] Fix | Delete
* // If today is 6 October 2014:
[52697] Fix | Delete
* const result = startOfToday()
[52698] Fix | Delete
* //=> Mon Oct 6 2014 00:00:00
[52699] Fix | Delete
*/
[52700] Fix | Delete
function startOfToday() {
[52701] Fix | Delete
return startOfDay(Date.now());
[52702] Fix | Delete
}
[52703] Fix | Delete
[52704] Fix | Delete
/**
[52705] Fix | Delete
* @name subMonths
[52706] Fix | Delete
* @category Month Helpers
[52707] Fix | Delete
* @summary Subtract the specified number of months from the given date.
[52708] Fix | Delete
*
[52709] Fix | Delete
* @description
[52710] Fix | Delete
* Subtract the specified number of months from the given date.
[52711] Fix | Delete
*
[52712] Fix | Delete
* @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).
[52713] Fix | Delete
*
[52714] Fix | Delete
* @param date - The date to be changed
[52715] Fix | Delete
* @param amount - The amount of months to be subtracted.
[52716] Fix | Delete
*
[52717] Fix | Delete
* @returns The new date with the months subtracted
[52718] Fix | Delete
*
[52719] Fix | Delete
* @example
[52720] Fix | Delete
* // Subtract 5 months from 1 February 2015:
[52721] Fix | Delete
* const result = subMonths(new Date(2015, 1, 1), 5)
[52722] Fix | Delete
* //=> Mon Sep 01 2014 00:00:00
[52723] Fix | Delete
*/
[52724] Fix | Delete
function subMonths(date, amount) {
[52725] Fix | Delete
return addMonths(date, -amount);
[52726] Fix | Delete
}
[52727] Fix | Delete
[52728] Fix | Delete
/**
[52729] Fix | Delete
* @name subYears
[52730] Fix | Delete
* @category Year Helpers
[52731] Fix | Delete
* @summary Subtract the specified number of years from the given date.
[52732] Fix | Delete
*
[52733] Fix | Delete
* @description
[52734] Fix | Delete
* Subtract the specified number of years from the given date.
[52735] Fix | Delete
*
[52736] Fix | Delete
* @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).
[52737] Fix | Delete
*
[52738] Fix | Delete
* @param date - The date to be changed
[52739] Fix | Delete
* @param amount - The amount of years to be subtracted.
[52740] Fix | Delete
*
[52741] Fix | Delete
* @returns The new date with the years subtracted
[52742] Fix | Delete
*
[52743] Fix | Delete
* @example
[52744] Fix | Delete
* // Subtract 5 years from 1 September 2014:
[52745] Fix | Delete
* const result = subYears(new Date(2014, 8, 1), 5)
[52746] Fix | Delete
* //=> Tue Sep 01 2009 00:00:00
[52747] Fix | Delete
*/
[52748] Fix | Delete
function subYears(date, amount) {
[52749] Fix | Delete
return addYears(date, -amount);
[52750] Fix | Delete
}
[52751] Fix | Delete
[52752] Fix | Delete
var Month;
[52753] Fix | Delete
(function (Month) {
[52754] Fix | Delete
Month[Month["JANUARY"] = 0] = "JANUARY";
[52755] Fix | Delete
Month[Month["FEBRUARY"] = 1] = "FEBRUARY";
[52756] Fix | Delete
Month[Month["MARCH"] = 2] = "MARCH";
[52757] Fix | Delete
Month[Month["APRIL"] = 3] = "APRIL";
[52758] Fix | Delete
Month[Month["MAY"] = 4] = "MAY";
[52759] Fix | Delete
Month[Month["JUNE"] = 5] = "JUNE";
[52760] Fix | Delete
Month[Month["JULY"] = 6] = "JULY";
[52761] Fix | Delete
Month[Month["AUGUST"] = 7] = "AUGUST";
[52762] Fix | Delete
Month[Month["SEPTEMBER"] = 8] = "SEPTEMBER";
[52763] Fix | Delete
Month[Month["OCTOBER"] = 9] = "OCTOBER";
[52764] Fix | Delete
Month[Month["NOVEMBER"] = 10] = "NOVEMBER";
[52765] Fix | Delete
Month[Month["DECEMBER"] = 11] = "DECEMBER";
[52766] Fix | Delete
})(Month || (Month = {}));
[52767] Fix | Delete
var Day;
[52768] Fix | Delete
(function (Day) {
[52769] Fix | Delete
Day[Day["SUNDAY"] = 0] = "SUNDAY";
[52770] Fix | Delete
Day[Day["MONDAY"] = 1] = "MONDAY";
[52771] Fix | Delete
Day[Day["TUESDAY"] = 2] = "TUESDAY";
[52772] Fix | Delete
Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY";
[52773] Fix | Delete
Day[Day["THURSDAY"] = 4] = "THURSDAY";
[52774] Fix | Delete
Day[Day["FRIDAY"] = 5] = "FRIDAY";
[52775] Fix | Delete
Day[Day["SATURDAY"] = 6] = "SATURDAY";
[52776] Fix | Delete
})(Day || (Day = {}));
[52777] Fix | Delete
var inRange = function (date, min, max) {
[52778] Fix | Delete
return (isEqual(date, min) || isAfter(date, min)) && (isEqual(date, max) || isBefore(date, max));
[52779] Fix | Delete
};
[52780] Fix | Delete
var index_es_clearTime = function (date) { return set(date, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }); };
[52781] Fix | Delete
var useLilius = function (_a) {
[52782] Fix | Delete
var _b = _a === void 0 ? {} : _a, _c = _b.weekStartsOn, weekStartsOn = _c === void 0 ? Day.SUNDAY : _c, _d = _b.viewing, initialViewing = _d === void 0 ? new Date() : _d, _e = _b.selected, initialSelected = _e === void 0 ? [] : _e, _f = _b.numberOfMonths, numberOfMonths = _f === void 0 ? 1 : _f;
[52783] Fix | Delete
var _g = (0,external_React_.useState)(initialViewing), viewing = _g[0], setViewing = _g[1];
[52784] Fix | Delete
var viewToday = (0,external_React_.useCallback)(function () { return setViewing(startOfToday()); }, [setViewing]);
[52785] Fix | Delete
var viewMonth = (0,external_React_.useCallback)(function (month) { return setViewing(function (v) { return setMonth(v, month); }); }, []);
[52786] Fix | Delete
var viewPreviousMonth = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return subMonths(v, 1); }); }, []);
[52787] Fix | Delete
var viewNextMonth = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return addMonths(v, 1); }); }, []);
[52788] Fix | Delete
var viewYear = (0,external_React_.useCallback)(function (year) { return setViewing(function (v) { return setYear(v, year); }); }, []);
[52789] Fix | Delete
var viewPreviousYear = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return subYears(v, 1); }); }, []);
[52790] Fix | Delete
var viewNextYear = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return addYears(v, 1); }); }, []);
[52791] Fix | Delete
var _h = (0,external_React_.useState)(initialSelected.map(index_es_clearTime)), selected = _h[0], setSelected = _h[1];
[52792] Fix | Delete
var clearSelected = function () { return setSelected([]); };
[52793] Fix | Delete
var isSelected = (0,external_React_.useCallback)(function (date) { return selected.findIndex(function (s) { return isEqual(s, date); }) > -1; }, [selected]);
[52794] Fix | Delete
var select = (0,external_React_.useCallback)(function (date, replaceExisting) {
[52795] Fix | Delete
if (replaceExisting) {
[52796] Fix | Delete
setSelected(Array.isArray(date) ? date : [date]);
[52797] Fix | Delete
}
[52798] Fix | Delete
else {
[52799] Fix | Delete
setSelected(function (selectedItems) { return selectedItems.concat(Array.isArray(date) ? date : [date]); });
[52800] Fix | Delete
}
[52801] Fix | Delete
}, []);
[52802] Fix | Delete
var deselect = (0,external_React_.useCallback)(function (date) {
[52803] Fix | Delete
return setSelected(function (selectedItems) {
[52804] Fix | Delete
return Array.isArray(date)
[52805] Fix | Delete
? selectedItems.filter(function (s) { return !date.map(function (d) { return d.getTime(); }).includes(s.getTime()); })
[52806] Fix | Delete
: selectedItems.filter(function (s) { return !isEqual(s, date); });
[52807] Fix | Delete
});
[52808] Fix | Delete
}, []);
[52809] Fix | Delete
var toggle = (0,external_React_.useCallback)(function (date, replaceExisting) { return (isSelected(date) ? deselect(date) : select(date, replaceExisting)); }, [deselect, isSelected, select]);
[52810] Fix | Delete
var selectRange = (0,external_React_.useCallback)(function (start, end, replaceExisting) {
[52811] Fix | Delete
if (replaceExisting) {
[52812] Fix | Delete
setSelected(eachDayOfInterval({ start: start, end: end }));
[52813] Fix | Delete
}
[52814] Fix | Delete
else {
[52815] Fix | Delete
setSelected(function (selectedItems) { return selectedItems.concat(eachDayOfInterval({ start: start, end: end })); });
[52816] Fix | Delete
}
[52817] Fix | Delete
}, []);
[52818] Fix | Delete
var deselectRange = (0,external_React_.useCallback)(function (start, end) {
[52819] Fix | Delete
setSelected(function (selectedItems) {
[52820] Fix | Delete
return selectedItems.filter(function (s) {
[52821] Fix | Delete
return !eachDayOfInterval({ start: start, end: end })
[52822] Fix | Delete
.map(function (d) { return d.getTime(); })
[52823] Fix | Delete
.includes(s.getTime());
[52824] Fix | Delete
});
[52825] Fix | Delete
});
[52826] Fix | Delete
}, []);
[52827] Fix | Delete
var calendar = (0,external_React_.useMemo)(function () {
[52828] Fix | Delete
return eachMonthOfInterval({
[52829] Fix | Delete
start: startOfMonth(viewing),
[52830] Fix | Delete
end: endOfMonth(addMonths(viewing, numberOfMonths - 1)),
[52831] Fix | Delete
}).map(function (month) {
[52832] Fix | Delete
return eachWeekOfInterval({
[52833] Fix | Delete
start: startOfMonth(month),
[52834] Fix | Delete
end: endOfMonth(month),
[52835] Fix | Delete
}, { weekStartsOn: weekStartsOn }).map(function (week) {
[52836] Fix | Delete
return eachDayOfInterval({
[52837] Fix | Delete
start: startOfWeek(week, { weekStartsOn: weekStartsOn }),
[52838] Fix | Delete
end: endOfWeek(week, { weekStartsOn: weekStartsOn }),
[52839] Fix | Delete
});
[52840] Fix | Delete
});
[52841] Fix | Delete
});
[52842] Fix | Delete
}, [viewing, weekStartsOn, numberOfMonths]);
[52843] Fix | Delete
return {
[52844] Fix | Delete
clearTime: index_es_clearTime,
[52845] Fix | Delete
inRange: inRange,
[52846] Fix | Delete
viewing: viewing,
[52847] Fix | Delete
setViewing: setViewing,
[52848] Fix | Delete
viewToday: viewToday,
[52849] Fix | Delete
viewMonth: viewMonth,
[52850] Fix | Delete
viewPreviousMonth: viewPreviousMonth,
[52851] Fix | Delete
viewNextMonth: viewNextMonth,
[52852] Fix | Delete
viewYear: viewYear,
[52853] Fix | Delete
viewPreviousYear: viewPreviousYear,
[52854] Fix | Delete
viewNextYear: viewNextYear,
[52855] Fix | Delete
selected: selected,
[52856] Fix | Delete
setSelected: setSelected,
[52857] Fix | Delete
clearSelected: clearSelected,
[52858] Fix | Delete
isSelected: isSelected,
[52859] Fix | Delete
select: select,
[52860] Fix | Delete
deselect: deselect,
[52861] Fix | Delete
toggle: toggle,
[52862] Fix | Delete
selectRange: selectRange,
[52863] Fix | Delete
deselectRange: deselectRange,
[52864] Fix | Delete
calendar: calendar,
[52865] Fix | Delete
};
[52866] Fix | Delete
};
[52867] Fix | Delete
[52868] Fix | Delete
[52869] Fix | Delete
[52870] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/toDate.mjs
[52871] Fix | Delete
/**
[52872] Fix | Delete
* @name toDate
[52873] Fix | Delete
* @category Common Helpers
[52874] Fix | Delete
* @summary Convert the given argument to an instance of Date.
[52875] Fix | Delete
*
[52876] Fix | Delete
* @description
[52877] Fix | Delete
* Convert the given argument to an instance of Date.
[52878] Fix | Delete
*
[52879] Fix | Delete
* If the argument is an instance of Date, the function returns its clone.
[52880] Fix | Delete
*
[52881] Fix | Delete
* If the argument is a number, it is treated as a timestamp.
[52882] Fix | Delete
*
[52883] Fix | Delete
* If the argument is none of the above, the function returns Invalid Date.
[52884] Fix | Delete
*
[52885] Fix | Delete
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
[52886] Fix | Delete
*
[52887] Fix | Delete
* @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).
[52888] Fix | Delete
*
[52889] Fix | Delete
* @param argument - The value to convert
[52890] Fix | Delete
*
[52891] Fix | Delete
* @returns The parsed date in the local time zone
[52892] Fix | Delete
*
[52893] Fix | Delete
* @example
[52894] Fix | Delete
* // Clone the date:
[52895] Fix | Delete
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
[52896] Fix | Delete
* //=> Tue Feb 11 2014 11:30:30
[52897] Fix | Delete
*
[52898] Fix | Delete
* @example
[52899] Fix | Delete
* // Convert the timestamp to date:
[52900] Fix | Delete
* const result = toDate(1392098430000)
[52901] Fix | Delete
* //=> Tue Feb 11 2014 11:30:30
[52902] Fix | Delete
*/
[52903] Fix | Delete
function toDate_toDate(argument) {
[52904] Fix | Delete
const argStr = Object.prototype.toString.call(argument);
[52905] Fix | Delete
[52906] Fix | Delete
// Clone the date
[52907] Fix | Delete
if (
[52908] Fix | Delete
argument instanceof Date ||
[52909] Fix | Delete
(typeof argument === "object" && argStr === "[object Date]")
[52910] Fix | Delete
) {
[52911] Fix | Delete
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
[52912] Fix | Delete
return new argument.constructor(+argument);
[52913] Fix | Delete
} else if (
[52914] Fix | Delete
typeof argument === "number" ||
[52915] Fix | Delete
argStr === "[object Number]" ||
[52916] Fix | Delete
typeof argument === "string" ||
[52917] Fix | Delete
argStr === "[object String]"
[52918] Fix | Delete
) {
[52919] Fix | Delete
// TODO: Can we get rid of as?
[52920] Fix | Delete
return new Date(argument);
[52921] Fix | Delete
} else {
[52922] Fix | Delete
// TODO: Can we get rid of as?
[52923] Fix | Delete
return new Date(NaN);
[52924] Fix | Delete
}
[52925] Fix | Delete
}
[52926] Fix | Delete
[52927] Fix | Delete
// Fallback for modularized imports:
[52928] Fix | Delete
/* harmony default export */ const date_fns_toDate = ((/* unused pure expression or super */ null && (toDate_toDate)));
[52929] Fix | Delete
[52930] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/startOfDay.mjs
[52931] Fix | Delete
[52932] Fix | Delete
[52933] Fix | Delete
/**
[52934] Fix | Delete
* @name startOfDay
[52935] Fix | Delete
* @category Day Helpers
[52936] Fix | Delete
* @summary Return the start of a day for the given date.
[52937] Fix | Delete
*
[52938] Fix | Delete
* @description
[52939] Fix | Delete
* Return the start of a day for the given date.
[52940] Fix | Delete
* The result will be in the local timezone.
[52941] Fix | Delete
*
[52942] Fix | Delete
* @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).
[52943] Fix | Delete
*
[52944] Fix | Delete
* @param date - The original date
[52945] Fix | Delete
*
[52946] Fix | Delete
* @returns The start of a day
[52947] Fix | Delete
*
[52948] Fix | Delete
* @example
[52949] Fix | Delete
* // The start of a day for 2 September 2014 11:55:00:
[52950] Fix | Delete
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
[52951] Fix | Delete
* //=> Tue Sep 02 2014 00:00:00
[52952] Fix | Delete
*/
[52953] Fix | Delete
function startOfDay_startOfDay(date) {
[52954] Fix | Delete
const _date = toDate_toDate(date);
[52955] Fix | Delete
_date.setHours(0, 0, 0, 0);
[52956] Fix | Delete
return _date;
[52957] Fix | Delete
}
[52958] Fix | Delete
[52959] Fix | Delete
// Fallback for modularized imports:
[52960] Fix | Delete
/* harmony default export */ const date_fns_startOfDay = ((/* unused pure expression or super */ null && (startOfDay_startOfDay)));
[52961] Fix | Delete
[52962] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/constructFrom.mjs
[52963] Fix | Delete
/**
[52964] Fix | Delete
* @name constructFrom
[52965] Fix | Delete
* @category Generic Helpers
[52966] Fix | Delete
* @summary Constructs a date using the reference date and the value
[52967] Fix | Delete
*
[52968] Fix | Delete
* @description
[52969] Fix | Delete
* The function constructs a new date using the constructor from the reference
[52970] Fix | Delete
* date and the given value. It helps to build generic functions that accept
[52971] Fix | Delete
* date extensions.
[52972] Fix | Delete
*
[52973] Fix | Delete
* It defaults to `Date` if the passed reference date is a number or a string.
[52974] Fix | Delete
*
[52975] Fix | Delete
* @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).
[52976] Fix | Delete
*
[52977] Fix | Delete
* @param date - The reference date to take constructor from
[52978] Fix | Delete
* @param value - The value to create the date
[52979] Fix | Delete
*
[52980] Fix | Delete
* @returns Date initialized using the given date and value
[52981] Fix | Delete
*
[52982] Fix | Delete
* @example
[52983] Fix | Delete
* import { constructFrom } from 'date-fns'
[52984] Fix | Delete
*
[52985] Fix | Delete
* // A function that clones a date preserving the original type
[52986] Fix | Delete
* function cloneDate<DateType extends Date(date: DateType): DateType {
[52987] Fix | Delete
* return constructFrom(
[52988] Fix | Delete
* date, // Use contrustor from the given date
[52989] Fix | Delete
* date.getTime() // Use the date value to create a new date
[52990] Fix | Delete
* )
[52991] Fix | Delete
* }
[52992] Fix | Delete
*/
[52993] Fix | Delete
function constructFrom_constructFrom(date, value) {
[52994] Fix | Delete
if (date instanceof Date) {
[52995] Fix | Delete
return new date.constructor(value);
[52996] Fix | Delete
} else {
[52997] Fix | Delete
return new Date(value);
[52998] Fix | Delete
}
[52999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function