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: date.js
*
[1500] Fix | Delete
* @return {number} Formatted date.
[1501] Fix | Delete
*/
[1502] Fix | Delete
B(momentDate) {
[1503] Fix | Delete
const timezoned = external_moment_default()(momentDate).utcOffset(60);
[1504] Fix | Delete
const seconds = parseInt(timezoned.format('s'), 10),
[1505] Fix | Delete
minutes = parseInt(timezoned.format('m'), 10),
[1506] Fix | Delete
hours = parseInt(timezoned.format('H'), 10);
[1507] Fix | Delete
return parseInt(((seconds + minutes * MINUTE_IN_SECONDS + hours * HOUR_IN_SECONDS) / 86.4).toString(), 10);
[1508] Fix | Delete
},
[1509] Fix | Delete
g: 'h',
[1510] Fix | Delete
G: 'H',
[1511] Fix | Delete
h: 'hh',
[1512] Fix | Delete
H: 'HH',
[1513] Fix | Delete
i: 'mm',
[1514] Fix | Delete
s: 'ss',
[1515] Fix | Delete
u: 'SSSSSS',
[1516] Fix | Delete
v: 'SSS',
[1517] Fix | Delete
// Timezone.
[1518] Fix | Delete
e: 'zz',
[1519] Fix | Delete
/**
[1520] Fix | Delete
* Gets whether the timezone is in DST currently.
[1521] Fix | Delete
*
[1522] Fix | Delete
* @param {Moment} momentDate Moment instance.
[1523] Fix | Delete
*
[1524] Fix | Delete
* @return {string} Formatted date.
[1525] Fix | Delete
*/
[1526] Fix | Delete
I(momentDate) {
[1527] Fix | Delete
return momentDate.isDST() ? '1' : '0';
[1528] Fix | Delete
},
[1529] Fix | Delete
O: 'ZZ',
[1530] Fix | Delete
P: 'Z',
[1531] Fix | Delete
T: 'z',
[1532] Fix | Delete
/**
[1533] Fix | Delete
* Gets the timezone offset in seconds.
[1534] Fix | Delete
*
[1535] Fix | Delete
* @param {Moment} momentDate Moment instance.
[1536] Fix | Delete
*
[1537] Fix | Delete
* @return {number} Formatted date.
[1538] Fix | Delete
*/
[1539] Fix | Delete
Z(momentDate) {
[1540] Fix | Delete
// Timezone offset in seconds.
[1541] Fix | Delete
const offset = momentDate.format('Z');
[1542] Fix | Delete
const sign = offset[0] === '-' ? -1 : 1;
[1543] Fix | Delete
const parts = offset.substring(1).split(':').map(n => parseInt(n, 10));
[1544] Fix | Delete
return sign * (parts[0] * HOUR_IN_MINUTES + parts[1]) * MINUTE_IN_SECONDS;
[1545] Fix | Delete
},
[1546] Fix | Delete
// Full date/time.
[1547] Fix | Delete
c: 'YYYY-MM-DDTHH:mm:ssZ',
[1548] Fix | Delete
// .toISOString.
[1549] Fix | Delete
/**
[1550] Fix | Delete
* Formats the date as RFC2822.
[1551] Fix | Delete
*
[1552] Fix | Delete
* @param {Moment} momentDate Moment instance.
[1553] Fix | Delete
*
[1554] Fix | Delete
* @return {string} Formatted date.
[1555] Fix | Delete
*/
[1556] Fix | Delete
r(momentDate) {
[1557] Fix | Delete
return momentDate.locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ');
[1558] Fix | Delete
},
[1559] Fix | Delete
U: 'X'
[1560] Fix | Delete
};
[1561] Fix | Delete
[1562] Fix | Delete
/**
[1563] Fix | Delete
* Formats a date. Does not alter the date's timezone.
[1564] Fix | Delete
*
[1565] Fix | Delete
* @param {string} dateFormat PHP-style formatting string.
[1566] Fix | Delete
* See php.net/date.
[1567] Fix | Delete
* @param {Moment | Date | string | undefined} dateValue Date object or string,
[1568] Fix | Delete
* parsable by moment.js.
[1569] Fix | Delete
*
[1570] Fix | Delete
* @return {string} Formatted date.
[1571] Fix | Delete
*/
[1572] Fix | Delete
function format(dateFormat, dateValue = new Date()) {
[1573] Fix | Delete
let i, char;
[1574] Fix | Delete
const newFormat = [];
[1575] Fix | Delete
const momentDate = external_moment_default()(dateValue);
[1576] Fix | Delete
for (i = 0; i < dateFormat.length; i++) {
[1577] Fix | Delete
char = dateFormat[i];
[1578] Fix | Delete
// Is this an escape?
[1579] Fix | Delete
if ('\\' === char) {
[1580] Fix | Delete
// Add next character, then move on.
[1581] Fix | Delete
i++;
[1582] Fix | Delete
newFormat.push('[' + dateFormat[i] + ']');
[1583] Fix | Delete
continue;
[1584] Fix | Delete
}
[1585] Fix | Delete
if (char in formatMap) {
[1586] Fix | Delete
const formatter = formatMap[( /** @type {keyof formatMap} */char)];
[1587] Fix | Delete
if (typeof formatter !== 'string') {
[1588] Fix | Delete
// If the format is a function, call it.
[1589] Fix | Delete
newFormat.push('[' + formatter(momentDate) + ']');
[1590] Fix | Delete
} else {
[1591] Fix | Delete
// Otherwise, add as a formatting string.
[1592] Fix | Delete
newFormat.push(formatter);
[1593] Fix | Delete
}
[1594] Fix | Delete
} else {
[1595] Fix | Delete
newFormat.push('[' + char + ']');
[1596] Fix | Delete
}
[1597] Fix | Delete
}
[1598] Fix | Delete
// Join with [] between to separate characters, and replace
[1599] Fix | Delete
// unneeded separators with static text.
[1600] Fix | Delete
return momentDate.format(newFormat.join('[]'));
[1601] Fix | Delete
}
[1602] Fix | Delete
[1603] Fix | Delete
/**
[1604] Fix | Delete
* Formats a date (like `date()` in PHP).
[1605] Fix | Delete
*
[1606] Fix | Delete
* @param {string} dateFormat PHP-style formatting string.
[1607] Fix | Delete
* See php.net/date.
[1608] Fix | Delete
* @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
[1609] Fix | Delete
* by moment.js.
[1610] Fix | Delete
* @param {string | number | undefined} timezone Timezone to output result in or a
[1611] Fix | Delete
* UTC offset. Defaults to timezone from
[1612] Fix | Delete
* site.
[1613] Fix | Delete
*
[1614] Fix | Delete
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
[1615] Fix | Delete
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
[1616] Fix | Delete
*
[1617] Fix | Delete
* @return {string} Formatted date in English.
[1618] Fix | Delete
*/
[1619] Fix | Delete
function date(dateFormat, dateValue = new Date(), timezone) {
[1620] Fix | Delete
const dateMoment = buildMoment(dateValue, timezone);
[1621] Fix | Delete
return format(dateFormat, dateMoment);
[1622] Fix | Delete
}
[1623] Fix | Delete
[1624] Fix | Delete
/**
[1625] Fix | Delete
* Formats a date (like `date()` in PHP), in the UTC timezone.
[1626] Fix | Delete
*
[1627] Fix | Delete
* @param {string} dateFormat PHP-style formatting string.
[1628] Fix | Delete
* See php.net/date.
[1629] Fix | Delete
* @param {Moment | Date | string | undefined} dateValue Date object or string,
[1630] Fix | Delete
* parsable by moment.js.
[1631] Fix | Delete
*
[1632] Fix | Delete
* @return {string} Formatted date in English.
[1633] Fix | Delete
*/
[1634] Fix | Delete
function gmdate(dateFormat, dateValue = new Date()) {
[1635] Fix | Delete
const dateMoment = external_moment_default()(dateValue).utc();
[1636] Fix | Delete
return format(dateFormat, dateMoment);
[1637] Fix | Delete
}
[1638] Fix | Delete
[1639] Fix | Delete
/**
[1640] Fix | Delete
* Formats a date (like `wp_date()` in PHP), translating it into site's locale.
[1641] Fix | Delete
*
[1642] Fix | Delete
* Backward Compatibility Notice: if `timezone` is set to `true`, the function
[1643] Fix | Delete
* behaves like `gmdateI18n`.
[1644] Fix | Delete
*
[1645] Fix | Delete
* @param {string} dateFormat PHP-style formatting string.
[1646] Fix | Delete
* See php.net/date.
[1647] Fix | Delete
* @param {Moment | Date | string | undefined} dateValue Date object or string, parsable by
[1648] Fix | Delete
* moment.js.
[1649] Fix | Delete
* @param {string | number | boolean | undefined} timezone Timezone to output result in or a
[1650] Fix | Delete
* UTC offset. Defaults to timezone from
[1651] Fix | Delete
* site. Notice: `boolean` is effectively
[1652] Fix | Delete
* deprecated, but still supported for
[1653] Fix | Delete
* backward compatibility reasons.
[1654] Fix | Delete
*
[1655] Fix | Delete
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
[1656] Fix | Delete
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
[1657] Fix | Delete
*
[1658] Fix | Delete
* @return {string} Formatted date.
[1659] Fix | Delete
*/
[1660] Fix | Delete
function dateI18n(dateFormat, dateValue = new Date(), timezone) {
[1661] Fix | Delete
if (true === timezone) {
[1662] Fix | Delete
return gmdateI18n(dateFormat, dateValue);
[1663] Fix | Delete
}
[1664] Fix | Delete
if (false === timezone) {
[1665] Fix | Delete
timezone = undefined;
[1666] Fix | Delete
}
[1667] Fix | Delete
const dateMoment = buildMoment(dateValue, timezone);
[1668] Fix | Delete
dateMoment.locale(settings.l10n.locale);
[1669] Fix | Delete
return format(dateFormat, dateMoment);
[1670] Fix | Delete
}
[1671] Fix | Delete
[1672] Fix | Delete
/**
[1673] Fix | Delete
* Formats a date (like `wp_date()` in PHP), translating it into site's locale
[1674] Fix | Delete
* and using the UTC timezone.
[1675] Fix | Delete
*
[1676] Fix | Delete
* @param {string} dateFormat PHP-style formatting string.
[1677] Fix | Delete
* See php.net/date.
[1678] Fix | Delete
* @param {Moment | Date | string | undefined} dateValue Date object or string,
[1679] Fix | Delete
* parsable by moment.js.
[1680] Fix | Delete
*
[1681] Fix | Delete
* @return {string} Formatted date.
[1682] Fix | Delete
*/
[1683] Fix | Delete
function gmdateI18n(dateFormat, dateValue = new Date()) {
[1684] Fix | Delete
const dateMoment = external_moment_default()(dateValue).utc();
[1685] Fix | Delete
dateMoment.locale(settings.l10n.locale);
[1686] Fix | Delete
return format(dateFormat, dateMoment);
[1687] Fix | Delete
}
[1688] Fix | Delete
[1689] Fix | Delete
/**
[1690] Fix | Delete
* Check whether a date is considered in the future according to the WordPress settings.
[1691] Fix | Delete
*
[1692] Fix | Delete
* @param {string} dateValue Date String or Date object in the Defined WP Timezone.
[1693] Fix | Delete
*
[1694] Fix | Delete
* @return {boolean} Is in the future.
[1695] Fix | Delete
*/
[1696] Fix | Delete
function isInTheFuture(dateValue) {
[1697] Fix | Delete
const now = external_moment_default().tz(WP_ZONE);
[1698] Fix | Delete
const momentObject = external_moment_default().tz(dateValue, WP_ZONE);
[1699] Fix | Delete
return momentObject.isAfter(now);
[1700] Fix | Delete
}
[1701] Fix | Delete
[1702] Fix | Delete
/**
[1703] Fix | Delete
* Create and return a JavaScript Date Object from a date string in the WP timezone.
[1704] Fix | Delete
*
[1705] Fix | Delete
* @param {string?} dateString Date formatted in the WP timezone.
[1706] Fix | Delete
*
[1707] Fix | Delete
* @return {Date} Date
[1708] Fix | Delete
*/
[1709] Fix | Delete
function getDate(dateString) {
[1710] Fix | Delete
if (!dateString) {
[1711] Fix | Delete
return external_moment_default().tz(WP_ZONE).toDate();
[1712] Fix | Delete
}
[1713] Fix | Delete
return external_moment_default().tz(dateString, WP_ZONE).toDate();
[1714] Fix | Delete
}
[1715] Fix | Delete
[1716] Fix | Delete
/**
[1717] Fix | Delete
* Returns a human-readable time difference between two dates, like human_time_diff() in PHP.
[1718] Fix | Delete
*
[1719] Fix | Delete
* @param {Moment | Date | string} from From date, in the WP timezone.
[1720] Fix | Delete
* @param {Moment | Date | string | undefined} to To date, formatted in the WP timezone.
[1721] Fix | Delete
*
[1722] Fix | Delete
* @return {string} Human-readable time difference.
[1723] Fix | Delete
*/
[1724] Fix | Delete
function humanTimeDiff(from, to) {
[1725] Fix | Delete
const fromMoment = external_moment_default().tz(from, WP_ZONE);
[1726] Fix | Delete
const toMoment = to ? external_moment_default().tz(to, WP_ZONE) : external_moment_default().tz(WP_ZONE);
[1727] Fix | Delete
return fromMoment.from(toMoment);
[1728] Fix | Delete
}
[1729] Fix | Delete
[1730] Fix | Delete
/**
[1731] Fix | Delete
* Creates a moment instance using the given timezone or, if none is provided, using global settings.
[1732] Fix | Delete
*
[1733] Fix | Delete
* @param {Moment | Date | string | undefined} dateValue Date object or string, parsable
[1734] Fix | Delete
* by moment.js.
[1735] Fix | Delete
* @param {string | number | undefined} timezone Timezone to output result in or a
[1736] Fix | Delete
* UTC offset. Defaults to timezone from
[1737] Fix | Delete
* site.
[1738] Fix | Delete
*
[1739] Fix | Delete
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
[1740] Fix | Delete
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC
[1741] Fix | Delete
*
[1742] Fix | Delete
* @return {Moment} a moment instance.
[1743] Fix | Delete
*/
[1744] Fix | Delete
function buildMoment(dateValue, timezone = '') {
[1745] Fix | Delete
const dateMoment = external_moment_default()(dateValue);
[1746] Fix | Delete
if (timezone && !isUTCOffset(timezone)) {
[1747] Fix | Delete
// The ! isUTCOffset() check guarantees that timezone is a string.
[1748] Fix | Delete
return dateMoment.tz( /** @type {string} */timezone);
[1749] Fix | Delete
}
[1750] Fix | Delete
if (timezone && isUTCOffset(timezone)) {
[1751] Fix | Delete
return dateMoment.utcOffset(timezone);
[1752] Fix | Delete
}
[1753] Fix | Delete
if (settings.timezone.string) {
[1754] Fix | Delete
return dateMoment.tz(settings.timezone.string);
[1755] Fix | Delete
}
[1756] Fix | Delete
return dateMoment.utcOffset(+settings.timezone.offset);
[1757] Fix | Delete
}
[1758] Fix | Delete
[1759] Fix | Delete
/**
[1760] Fix | Delete
* Returns whether a certain UTC offset is valid or not.
[1761] Fix | Delete
*
[1762] Fix | Delete
* @param {number|string} offset a UTC offset.
[1763] Fix | Delete
*
[1764] Fix | Delete
* @return {boolean} whether a certain UTC offset is valid or not.
[1765] Fix | Delete
*/
[1766] Fix | Delete
function isUTCOffset(offset) {
[1767] Fix | Delete
if ('number' === typeof offset) {
[1768] Fix | Delete
return true;
[1769] Fix | Delete
}
[1770] Fix | Delete
return VALID_UTC_OFFSET.test(offset);
[1771] Fix | Delete
}
[1772] Fix | Delete
setupWPTimezone();
[1773] Fix | Delete
[1774] Fix | Delete
})();
[1775] Fix | Delete
[1776] Fix | Delete
(window.wp = window.wp || {}).date = __webpack_exports__;
[1777] Fix | Delete
/******/ })()
[1778] Fix | Delete
;
[1779] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function