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
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
[54000] Fix | Delete
* which would lead to incorrect calculations.
[54001] Fix | Delete
*
[54002] Fix | Delete
* This function returns the timezone offset in milliseconds that takes seconds in account.
[54003] Fix | Delete
*/
[54004] Fix | Delete
function getTimezoneOffsetInMilliseconds(date) {
[54005] Fix | Delete
const _date = toDate_toDate(date);
[54006] Fix | Delete
const utcDate = new Date(
[54007] Fix | Delete
Date.UTC(
[54008] Fix | Delete
_date.getFullYear(),
[54009] Fix | Delete
_date.getMonth(),
[54010] Fix | Delete
_date.getDate(),
[54011] Fix | Delete
_date.getHours(),
[54012] Fix | Delete
_date.getMinutes(),
[54013] Fix | Delete
_date.getSeconds(),
[54014] Fix | Delete
_date.getMilliseconds(),
[54015] Fix | Delete
),
[54016] Fix | Delete
);
[54017] Fix | Delete
utcDate.setUTCFullYear(_date.getFullYear());
[54018] Fix | Delete
return +date - +utcDate;
[54019] Fix | Delete
}
[54020] Fix | Delete
[54021] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/differenceInCalendarDays.mjs
[54022] Fix | Delete
[54023] Fix | Delete
[54024] Fix | Delete
[54025] Fix | Delete
[54026] Fix | Delete
/**
[54027] Fix | Delete
* @name differenceInCalendarDays
[54028] Fix | Delete
* @category Day Helpers
[54029] Fix | Delete
* @summary Get the number of calendar days between the given dates.
[54030] Fix | Delete
*
[54031] Fix | Delete
* @description
[54032] Fix | Delete
* Get the number of calendar days between the given dates. This means that the times are removed
[54033] Fix | Delete
* from the dates and then the difference in days is calculated.
[54034] Fix | Delete
*
[54035] 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).
[54036] Fix | Delete
*
[54037] Fix | Delete
* @param dateLeft - The later date
[54038] Fix | Delete
* @param dateRight - The earlier date
[54039] Fix | Delete
*
[54040] Fix | Delete
* @returns The number of calendar days
[54041] Fix | Delete
*
[54042] Fix | Delete
* @example
[54043] Fix | Delete
* // How many calendar days are between
[54044] Fix | Delete
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
[54045] Fix | Delete
* const result = differenceInCalendarDays(
[54046] Fix | Delete
* new Date(2012, 6, 2, 0, 0),
[54047] Fix | Delete
* new Date(2011, 6, 2, 23, 0)
[54048] Fix | Delete
* )
[54049] Fix | Delete
* //=> 366
[54050] Fix | Delete
* // How many calendar days are between
[54051] Fix | Delete
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
[54052] Fix | Delete
* const result = differenceInCalendarDays(
[54053] Fix | Delete
* new Date(2011, 6, 3, 0, 1),
[54054] Fix | Delete
* new Date(2011, 6, 2, 23, 59)
[54055] Fix | Delete
* )
[54056] Fix | Delete
* //=> 1
[54057] Fix | Delete
*/
[54058] Fix | Delete
function differenceInCalendarDays(dateLeft, dateRight) {
[54059] Fix | Delete
const startOfDayLeft = startOfDay_startOfDay(dateLeft);
[54060] Fix | Delete
const startOfDayRight = startOfDay_startOfDay(dateRight);
[54061] Fix | Delete
[54062] Fix | Delete
const timestampLeft =
[54063] Fix | Delete
+startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
[54064] Fix | Delete
const timestampRight =
[54065] Fix | Delete
+startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
[54066] Fix | Delete
[54067] Fix | Delete
// Round the number of days to the nearest integer because the number of
[54068] Fix | Delete
// milliseconds in a day is not constant (e.g. it's different in the week of
[54069] Fix | Delete
// the daylight saving time clock shift).
[54070] Fix | Delete
return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
[54071] Fix | Delete
}
[54072] Fix | Delete
[54073] Fix | Delete
// Fallback for modularized imports:
[54074] Fix | Delete
/* harmony default export */ const date_fns_differenceInCalendarDays = ((/* unused pure expression or super */ null && (differenceInCalendarDays)));
[54075] Fix | Delete
[54076] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/startOfYear.mjs
[54077] Fix | Delete
[54078] Fix | Delete
[54079] Fix | Delete
[54080] Fix | Delete
/**
[54081] Fix | Delete
* @name startOfYear
[54082] Fix | Delete
* @category Year Helpers
[54083] Fix | Delete
* @summary Return the start of a year for the given date.
[54084] Fix | Delete
*
[54085] Fix | Delete
* @description
[54086] Fix | Delete
* Return the start of a year for the given date.
[54087] Fix | Delete
* The result will be in the local timezone.
[54088] Fix | Delete
*
[54089] 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).
[54090] Fix | Delete
*
[54091] Fix | Delete
* @param date - The original date
[54092] Fix | Delete
*
[54093] Fix | Delete
* @returns The start of a year
[54094] Fix | Delete
*
[54095] Fix | Delete
* @example
[54096] Fix | Delete
* // The start of a year for 2 September 2014 11:55:00:
[54097] Fix | Delete
* const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
[54098] Fix | Delete
* //=> Wed Jan 01 2014 00:00:00
[54099] Fix | Delete
*/
[54100] Fix | Delete
function startOfYear(date) {
[54101] Fix | Delete
const cleanDate = toDate_toDate(date);
[54102] Fix | Delete
const _date = constructFrom_constructFrom(date, 0);
[54103] Fix | Delete
_date.setFullYear(cleanDate.getFullYear(), 0, 1);
[54104] Fix | Delete
_date.setHours(0, 0, 0, 0);
[54105] Fix | Delete
return _date;
[54106] Fix | Delete
}
[54107] Fix | Delete
[54108] Fix | Delete
// Fallback for modularized imports:
[54109] Fix | Delete
/* harmony default export */ const date_fns_startOfYear = ((/* unused pure expression or super */ null && (startOfYear)));
[54110] Fix | Delete
[54111] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/getDayOfYear.mjs
[54112] Fix | Delete
[54113] Fix | Delete
[54114] Fix | Delete
[54115] Fix | Delete
[54116] Fix | Delete
/**
[54117] Fix | Delete
* @name getDayOfYear
[54118] Fix | Delete
* @category Day Helpers
[54119] Fix | Delete
* @summary Get the day of the year of the given date.
[54120] Fix | Delete
*
[54121] Fix | Delete
* @description
[54122] Fix | Delete
* Get the day of the year of the given date.
[54123] Fix | Delete
*
[54124] 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).
[54125] Fix | Delete
*
[54126] Fix | Delete
* @param date - The given date
[54127] Fix | Delete
*
[54128] Fix | Delete
* @returns The day of year
[54129] Fix | Delete
*
[54130] Fix | Delete
* @example
[54131] Fix | Delete
* // Which day of the year is 2 July 2014?
[54132] Fix | Delete
* const result = getDayOfYear(new Date(2014, 6, 2))
[54133] Fix | Delete
* //=> 183
[54134] Fix | Delete
*/
[54135] Fix | Delete
function getDayOfYear(date) {
[54136] Fix | Delete
const _date = toDate_toDate(date);
[54137] Fix | Delete
const diff = differenceInCalendarDays(_date, startOfYear(_date));
[54138] Fix | Delete
const dayOfYear = diff + 1;
[54139] Fix | Delete
return dayOfYear;
[54140] Fix | Delete
}
[54141] Fix | Delete
[54142] Fix | Delete
// Fallback for modularized imports:
[54143] Fix | Delete
/* harmony default export */ const date_fns_getDayOfYear = ((/* unused pure expression or super */ null && (getDayOfYear)));
[54144] Fix | Delete
[54145] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/startOfWeek.mjs
[54146] Fix | Delete
[54147] Fix | Delete
[54148] Fix | Delete
[54149] Fix | Delete
/**
[54150] Fix | Delete
* The {@link startOfWeek} function options.
[54151] Fix | Delete
*/
[54152] Fix | Delete
[54153] Fix | Delete
/**
[54154] Fix | Delete
* @name startOfWeek
[54155] Fix | Delete
* @category Week Helpers
[54156] Fix | Delete
* @summary Return the start of a week for the given date.
[54157] Fix | Delete
*
[54158] Fix | Delete
* @description
[54159] Fix | Delete
* Return the start of a week for the given date.
[54160] Fix | Delete
* The result will be in the local timezone.
[54161] Fix | Delete
*
[54162] 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).
[54163] Fix | Delete
*
[54164] Fix | Delete
* @param date - The original date
[54165] Fix | Delete
* @param options - An object with options
[54166] Fix | Delete
*
[54167] Fix | Delete
* @returns The start of a week
[54168] Fix | Delete
*
[54169] Fix | Delete
* @example
[54170] Fix | Delete
* // The start of a week for 2 September 2014 11:55:00:
[54171] Fix | Delete
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
[54172] Fix | Delete
* //=> Sun Aug 31 2014 00:00:00
[54173] Fix | Delete
*
[54174] Fix | Delete
* @example
[54175] Fix | Delete
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
[54176] Fix | Delete
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
[54177] Fix | Delete
* //=> Mon Sep 01 2014 00:00:00
[54178] Fix | Delete
*/
[54179] Fix | Delete
function startOfWeek_startOfWeek(date, options) {
[54180] Fix | Delete
const defaultOptions = defaultOptions_getDefaultOptions();
[54181] Fix | Delete
const weekStartsOn =
[54182] Fix | Delete
options?.weekStartsOn ??
[54183] Fix | Delete
options?.locale?.options?.weekStartsOn ??
[54184] Fix | Delete
defaultOptions.weekStartsOn ??
[54185] Fix | Delete
defaultOptions.locale?.options?.weekStartsOn ??
[54186] Fix | Delete
0;
[54187] Fix | Delete
[54188] Fix | Delete
const _date = toDate_toDate(date);
[54189] Fix | Delete
const day = _date.getDay();
[54190] Fix | Delete
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
[54191] Fix | Delete
[54192] Fix | Delete
_date.setDate(_date.getDate() - diff);
[54193] Fix | Delete
_date.setHours(0, 0, 0, 0);
[54194] Fix | Delete
return _date;
[54195] Fix | Delete
}
[54196] Fix | Delete
[54197] Fix | Delete
// Fallback for modularized imports:
[54198] Fix | Delete
/* harmony default export */ const date_fns_startOfWeek = ((/* unused pure expression or super */ null && (startOfWeek_startOfWeek)));
[54199] Fix | Delete
[54200] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/startOfISOWeek.mjs
[54201] Fix | Delete
[54202] Fix | Delete
[54203] Fix | Delete
/**
[54204] Fix | Delete
* @name startOfISOWeek
[54205] Fix | Delete
* @category ISO Week Helpers
[54206] Fix | Delete
* @summary Return the start of an ISO week for the given date.
[54207] Fix | Delete
*
[54208] Fix | Delete
* @description
[54209] Fix | Delete
* Return the start of an ISO week for the given date.
[54210] Fix | Delete
* The result will be in the local timezone.
[54211] Fix | Delete
*
[54212] Fix | Delete
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
[54213] Fix | Delete
*
[54214] 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).
[54215] Fix | Delete
*
[54216] Fix | Delete
* @param date - The original date
[54217] Fix | Delete
*
[54218] Fix | Delete
* @returns The start of an ISO week
[54219] Fix | Delete
*
[54220] Fix | Delete
* @example
[54221] Fix | Delete
* // The start of an ISO week for 2 September 2014 11:55:00:
[54222] Fix | Delete
* const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
[54223] Fix | Delete
* //=> Mon Sep 01 2014 00:00:00
[54224] Fix | Delete
*/
[54225] Fix | Delete
function startOfISOWeek(date) {
[54226] Fix | Delete
return startOfWeek_startOfWeek(date, { weekStartsOn: 1 });
[54227] Fix | Delete
}
[54228] Fix | Delete
[54229] Fix | Delete
// Fallback for modularized imports:
[54230] Fix | Delete
/* harmony default export */ const date_fns_startOfISOWeek = ((/* unused pure expression or super */ null && (startOfISOWeek)));
[54231] Fix | Delete
[54232] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/getISOWeekYear.mjs
[54233] Fix | Delete
[54234] Fix | Delete
[54235] Fix | Delete
[54236] Fix | Delete
[54237] Fix | Delete
/**
[54238] Fix | Delete
* @name getISOWeekYear
[54239] Fix | Delete
* @category ISO Week-Numbering Year Helpers
[54240] Fix | Delete
* @summary Get the ISO week-numbering year of the given date.
[54241] Fix | Delete
*
[54242] Fix | Delete
* @description
[54243] Fix | Delete
* Get the ISO week-numbering year of the given date,
[54244] Fix | Delete
* which always starts 3 days before the year's first Thursday.
[54245] Fix | Delete
*
[54246] Fix | Delete
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
[54247] Fix | Delete
*
[54248] 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).
[54249] Fix | Delete
*
[54250] Fix | Delete
* @param date - The given date
[54251] Fix | Delete
*
[54252] Fix | Delete
* @returns The ISO week-numbering year
[54253] Fix | Delete
*
[54254] Fix | Delete
* @example
[54255] Fix | Delete
* // Which ISO-week numbering year is 2 January 2005?
[54256] Fix | Delete
* const result = getISOWeekYear(new Date(2005, 0, 2))
[54257] Fix | Delete
* //=> 2004
[54258] Fix | Delete
*/
[54259] Fix | Delete
function getISOWeekYear(date) {
[54260] Fix | Delete
const _date = toDate_toDate(date);
[54261] Fix | Delete
const year = _date.getFullYear();
[54262] Fix | Delete
[54263] Fix | Delete
const fourthOfJanuaryOfNextYear = constructFrom_constructFrom(date, 0);
[54264] Fix | Delete
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
[54265] Fix | Delete
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
[54266] Fix | Delete
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
[54267] Fix | Delete
[54268] Fix | Delete
const fourthOfJanuaryOfThisYear = constructFrom_constructFrom(date, 0);
[54269] Fix | Delete
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
[54270] Fix | Delete
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
[54271] Fix | Delete
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
[54272] Fix | Delete
[54273] Fix | Delete
if (_date.getTime() >= startOfNextYear.getTime()) {
[54274] Fix | Delete
return year + 1;
[54275] Fix | Delete
} else if (_date.getTime() >= startOfThisYear.getTime()) {
[54276] Fix | Delete
return year;
[54277] Fix | Delete
} else {
[54278] Fix | Delete
return year - 1;
[54279] Fix | Delete
}
[54280] Fix | Delete
}
[54281] Fix | Delete
[54282] Fix | Delete
// Fallback for modularized imports:
[54283] Fix | Delete
/* harmony default export */ const date_fns_getISOWeekYear = ((/* unused pure expression or super */ null && (getISOWeekYear)));
[54284] Fix | Delete
[54285] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/startOfISOWeekYear.mjs
[54286] Fix | Delete
[54287] Fix | Delete
[54288] Fix | Delete
[54289] Fix | Delete
[54290] Fix | Delete
/**
[54291] Fix | Delete
* @name startOfISOWeekYear
[54292] Fix | Delete
* @category ISO Week-Numbering Year Helpers
[54293] Fix | Delete
* @summary Return the start of an ISO week-numbering year for the given date.
[54294] Fix | Delete
*
[54295] Fix | Delete
* @description
[54296] Fix | Delete
* Return the start of an ISO week-numbering year,
[54297] Fix | Delete
* which always starts 3 days before the year's first Thursday.
[54298] Fix | Delete
* The result will be in the local timezone.
[54299] Fix | Delete
*
[54300] Fix | Delete
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
[54301] Fix | Delete
*
[54302] 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).
[54303] Fix | Delete
*
[54304] Fix | Delete
* @param date - The original date
[54305] Fix | Delete
*
[54306] Fix | Delete
* @returns The start of an ISO week-numbering year
[54307] Fix | Delete
*
[54308] Fix | Delete
* @example
[54309] Fix | Delete
* // The start of an ISO week-numbering year for 2 July 2005:
[54310] Fix | Delete
* const result = startOfISOWeekYear(new Date(2005, 6, 2))
[54311] Fix | Delete
* //=> Mon Jan 03 2005 00:00:00
[54312] Fix | Delete
*/
[54313] Fix | Delete
function startOfISOWeekYear(date) {
[54314] Fix | Delete
const year = getISOWeekYear(date);
[54315] Fix | Delete
const fourthOfJanuary = constructFrom_constructFrom(date, 0);
[54316] Fix | Delete
fourthOfJanuary.setFullYear(year, 0, 4);
[54317] Fix | Delete
fourthOfJanuary.setHours(0, 0, 0, 0);
[54318] Fix | Delete
return startOfISOWeek(fourthOfJanuary);
[54319] Fix | Delete
}
[54320] Fix | Delete
[54321] Fix | Delete
// Fallback for modularized imports:
[54322] Fix | Delete
/* harmony default export */ const date_fns_startOfISOWeekYear = ((/* unused pure expression or super */ null && (startOfISOWeekYear)));
[54323] Fix | Delete
[54324] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/getISOWeek.mjs
[54325] Fix | Delete
[54326] Fix | Delete
[54327] Fix | Delete
[54328] Fix | Delete
[54329] Fix | Delete
[54330] Fix | Delete
/**
[54331] Fix | Delete
* @name getISOWeek
[54332] Fix | Delete
* @category ISO Week Helpers
[54333] Fix | Delete
* @summary Get the ISO week of the given date.
[54334] Fix | Delete
*
[54335] Fix | Delete
* @description
[54336] Fix | Delete
* Get the ISO week of the given date.
[54337] Fix | Delete
*
[54338] Fix | Delete
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
[54339] Fix | Delete
*
[54340] 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).
[54341] Fix | Delete
*
[54342] Fix | Delete
* @param date - The given date
[54343] Fix | Delete
*
[54344] Fix | Delete
* @returns The ISO week
[54345] Fix | Delete
*
[54346] Fix | Delete
* @example
[54347] Fix | Delete
* // Which week of the ISO-week numbering year is 2 January 2005?
[54348] Fix | Delete
* const result = getISOWeek(new Date(2005, 0, 2))
[54349] Fix | Delete
* //=> 53
[54350] Fix | Delete
*/
[54351] Fix | Delete
function getISOWeek(date) {
[54352] Fix | Delete
const _date = toDate_toDate(date);
[54353] Fix | Delete
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
[54354] Fix | Delete
[54355] Fix | Delete
// Round the number of weeks to the nearest integer because the number of
[54356] Fix | Delete
// milliseconds in a week is not constant (e.g. it's different in the week of
[54357] Fix | Delete
// the daylight saving time clock shift).
[54358] Fix | Delete
return Math.round(diff / millisecondsInWeek) + 1;
[54359] Fix | Delete
}
[54360] Fix | Delete
[54361] Fix | Delete
// Fallback for modularized imports:
[54362] Fix | Delete
/* harmony default export */ const date_fns_getISOWeek = ((/* unused pure expression or super */ null && (getISOWeek)));
[54363] Fix | Delete
[54364] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/getWeekYear.mjs
[54365] Fix | Delete
[54366] Fix | Delete
[54367] Fix | Delete
[54368] Fix | Delete
[54369] Fix | Delete
[54370] Fix | Delete
/**
[54371] Fix | Delete
* The {@link getWeekYear} function options.
[54372] Fix | Delete
*/
[54373] Fix | Delete
[54374] Fix | Delete
/**
[54375] Fix | Delete
* @name getWeekYear
[54376] Fix | Delete
* @category Week-Numbering Year Helpers
[54377] Fix | Delete
* @summary Get the local week-numbering year of the given date.
[54378] Fix | Delete
*
[54379] Fix | Delete
* @description
[54380] Fix | Delete
* Get the local week-numbering year of the given date.
[54381] Fix | Delete
* The exact calculation depends on the values of
[54382] Fix | Delete
* `options.weekStartsOn` (which is the index of the first day of the week)
[54383] Fix | Delete
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
[54384] Fix | Delete
* the first week of the week-numbering year)
[54385] Fix | Delete
*
[54386] Fix | Delete
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
[54387] Fix | Delete
*
[54388] 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).
[54389] Fix | Delete
*
[54390] Fix | Delete
* @param date - The given date
[54391] Fix | Delete
* @param options - An object with options.
[54392] Fix | Delete
*
[54393] Fix | Delete
* @returns The local week-numbering year
[54394] Fix | Delete
*
[54395] Fix | Delete
* @example
[54396] Fix | Delete
* // Which week numbering year is 26 December 2004 with the default settings?
[54397] Fix | Delete
* const result = getWeekYear(new Date(2004, 11, 26))
[54398] Fix | Delete
* //=> 2005
[54399] Fix | Delete
*
[54400] Fix | Delete
* @example
[54401] Fix | Delete
* // Which week numbering year is 26 December 2004 if week starts on Saturday?
[54402] Fix | Delete
* const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
[54403] Fix | Delete
* //=> 2004
[54404] Fix | Delete
*
[54405] Fix | Delete
* @example
[54406] Fix | Delete
* // Which week numbering year is 26 December 2004 if the first week contains 4 January?
[54407] Fix | Delete
* const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
[54408] Fix | Delete
* //=> 2004
[54409] Fix | Delete
*/
[54410] Fix | Delete
function getWeekYear(date, options) {
[54411] Fix | Delete
const _date = toDate_toDate(date);
[54412] Fix | Delete
const year = _date.getFullYear();
[54413] Fix | Delete
[54414] Fix | Delete
const defaultOptions = defaultOptions_getDefaultOptions();
[54415] Fix | Delete
const firstWeekContainsDate =
[54416] Fix | Delete
options?.firstWeekContainsDate ??
[54417] Fix | Delete
options?.locale?.options?.firstWeekContainsDate ??
[54418] Fix | Delete
defaultOptions.firstWeekContainsDate ??
[54419] Fix | Delete
defaultOptions.locale?.options?.firstWeekContainsDate ??
[54420] Fix | Delete
1;
[54421] Fix | Delete
[54422] Fix | Delete
const firstWeekOfNextYear = constructFrom_constructFrom(date, 0);
[54423] Fix | Delete
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
[54424] Fix | Delete
firstWeekOfNextYear.setHours(0, 0, 0, 0);
[54425] Fix | Delete
const startOfNextYear = startOfWeek_startOfWeek(firstWeekOfNextYear, options);
[54426] Fix | Delete
[54427] Fix | Delete
const firstWeekOfThisYear = constructFrom_constructFrom(date, 0);
[54428] Fix | Delete
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
[54429] Fix | Delete
firstWeekOfThisYear.setHours(0, 0, 0, 0);
[54430] Fix | Delete
const startOfThisYear = startOfWeek_startOfWeek(firstWeekOfThisYear, options);
[54431] Fix | Delete
[54432] Fix | Delete
if (_date.getTime() >= startOfNextYear.getTime()) {
[54433] Fix | Delete
return year + 1;
[54434] Fix | Delete
} else if (_date.getTime() >= startOfThisYear.getTime()) {
[54435] Fix | Delete
return year;
[54436] Fix | Delete
} else {
[54437] Fix | Delete
return year - 1;
[54438] Fix | Delete
}
[54439] Fix | Delete
}
[54440] Fix | Delete
[54441] Fix | Delete
// Fallback for modularized imports:
[54442] Fix | Delete
/* harmony default export */ const date_fns_getWeekYear = ((/* unused pure expression or super */ null && (getWeekYear)));
[54443] Fix | Delete
[54444] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/date-fns/startOfWeekYear.mjs
[54445] Fix | Delete
[54446] Fix | Delete
[54447] Fix | Delete
[54448] Fix | Delete
[54449] Fix | Delete
[54450] Fix | Delete
/**
[54451] Fix | Delete
* The {@link startOfWeekYear} function options.
[54452] Fix | Delete
*/
[54453] Fix | Delete
[54454] Fix | Delete
/**
[54455] Fix | Delete
* @name startOfWeekYear
[54456] Fix | Delete
* @category Week-Numbering Year Helpers
[54457] Fix | Delete
* @summary Return the start of a local week-numbering year for the given date.
[54458] Fix | Delete
*
[54459] Fix | Delete
* @description
[54460] Fix | Delete
* Return the start of a local week-numbering year.
[54461] Fix | Delete
* The exact calculation depends on the values of
[54462] Fix | Delete
* `options.weekStartsOn` (which is the index of the first day of the week)
[54463] Fix | Delete
* and `options.firstWeekContainsDate` (which is the day of January, which is always in
[54464] Fix | Delete
* the first week of the week-numbering year)
[54465] Fix | Delete
*
[54466] Fix | Delete
* Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
[54467] Fix | Delete
*
[54468] 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).
[54469] Fix | Delete
*
[54470] Fix | Delete
* @param date - The original date
[54471] Fix | Delete
* @param options - An object with options
[54472] Fix | Delete
*
[54473] Fix | Delete
* @returns The start of a week-numbering year
[54474] Fix | Delete
*
[54475] Fix | Delete
* @example
[54476] Fix | Delete
* // The start of an a week-numbering year for 2 July 2005 with default settings:
[54477] Fix | Delete
* const result = startOfWeekYear(new Date(2005, 6, 2))
[54478] Fix | Delete
* //=> Sun Dec 26 2004 00:00:00
[54479] Fix | Delete
*
[54480] Fix | Delete
* @example
[54481] Fix | Delete
* // The start of a week-numbering year for 2 July 2005
[54482] Fix | Delete
* // if Monday is the first day of week
[54483] Fix | Delete
* // and 4 January is always in the first week of the year:
[54484] Fix | Delete
* const result = startOfWeekYear(new Date(2005, 6, 2), {
[54485] Fix | Delete
* weekStartsOn: 1,
[54486] Fix | Delete
* firstWeekContainsDate: 4
[54487] Fix | Delete
* })
[54488] Fix | Delete
* //=> Mon Jan 03 2005 00:00:00
[54489] Fix | Delete
*/
[54490] Fix | Delete
function startOfWeekYear(date, options) {
[54491] Fix | Delete
const defaultOptions = defaultOptions_getDefaultOptions();
[54492] Fix | Delete
const firstWeekContainsDate =
[54493] Fix | Delete
options?.firstWeekContainsDate ??
[54494] Fix | Delete
options?.locale?.options?.firstWeekContainsDate ??
[54495] Fix | Delete
defaultOptions.firstWeekContainsDate ??
[54496] Fix | Delete
defaultOptions.locale?.options?.firstWeekContainsDate ??
[54497] Fix | Delete
1;
[54498] Fix | Delete
[54499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function