Edit File by line
/home/barbar84/www/wp-inclu.../js/dist/vendor
File: moment.js
}
[2000] Fix | Delete
}
[2001] Fix | Delete
[2002] Fix | Delete
var baseConfig = {
[2003] Fix | Delete
calendar: defaultCalendar,
[2004] Fix | Delete
longDateFormat: defaultLongDateFormat,
[2005] Fix | Delete
invalidDate: defaultInvalidDate,
[2006] Fix | Delete
ordinal: defaultOrdinal,
[2007] Fix | Delete
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
[2008] Fix | Delete
relativeTime: defaultRelativeTime,
[2009] Fix | Delete
[2010] Fix | Delete
months: defaultLocaleMonths,
[2011] Fix | Delete
monthsShort: defaultLocaleMonthsShort,
[2012] Fix | Delete
[2013] Fix | Delete
week: defaultLocaleWeek,
[2014] Fix | Delete
[2015] Fix | Delete
weekdays: defaultLocaleWeekdays,
[2016] Fix | Delete
weekdaysMin: defaultLocaleWeekdaysMin,
[2017] Fix | Delete
weekdaysShort: defaultLocaleWeekdaysShort,
[2018] Fix | Delete
[2019] Fix | Delete
meridiemParse: defaultLocaleMeridiemParse,
[2020] Fix | Delete
};
[2021] Fix | Delete
[2022] Fix | Delete
// internal storage for locale config files
[2023] Fix | Delete
var locales = {},
[2024] Fix | Delete
localeFamilies = {},
[2025] Fix | Delete
globalLocale;
[2026] Fix | Delete
[2027] Fix | Delete
function commonPrefix(arr1, arr2) {
[2028] Fix | Delete
var i,
[2029] Fix | Delete
minl = Math.min(arr1.length, arr2.length);
[2030] Fix | Delete
for (i = 0; i < minl; i += 1) {
[2031] Fix | Delete
if (arr1[i] !== arr2[i]) {
[2032] Fix | Delete
return i;
[2033] Fix | Delete
}
[2034] Fix | Delete
}
[2035] Fix | Delete
return minl;
[2036] Fix | Delete
}
[2037] Fix | Delete
[2038] Fix | Delete
function normalizeLocale(key) {
[2039] Fix | Delete
return key ? key.toLowerCase().replace('_', '-') : key;
[2040] Fix | Delete
}
[2041] Fix | Delete
[2042] Fix | Delete
// pick the locale from the array
[2043] Fix | Delete
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
[2044] Fix | Delete
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
[2045] Fix | Delete
function chooseLocale(names) {
[2046] Fix | Delete
var i = 0,
[2047] Fix | Delete
j,
[2048] Fix | Delete
next,
[2049] Fix | Delete
locale,
[2050] Fix | Delete
split;
[2051] Fix | Delete
[2052] Fix | Delete
while (i < names.length) {
[2053] Fix | Delete
split = normalizeLocale(names[i]).split('-');
[2054] Fix | Delete
j = split.length;
[2055] Fix | Delete
next = normalizeLocale(names[i + 1]);
[2056] Fix | Delete
next = next ? next.split('-') : null;
[2057] Fix | Delete
while (j > 0) {
[2058] Fix | Delete
locale = loadLocale(split.slice(0, j).join('-'));
[2059] Fix | Delete
if (locale) {
[2060] Fix | Delete
return locale;
[2061] Fix | Delete
}
[2062] Fix | Delete
if (
[2063] Fix | Delete
next &&
[2064] Fix | Delete
next.length >= j &&
[2065] Fix | Delete
commonPrefix(split, next) >= j - 1
[2066] Fix | Delete
) {
[2067] Fix | Delete
//the next array item is better than a shallower substring of this one
[2068] Fix | Delete
break;
[2069] Fix | Delete
}
[2070] Fix | Delete
j--;
[2071] Fix | Delete
}
[2072] Fix | Delete
i++;
[2073] Fix | Delete
}
[2074] Fix | Delete
return globalLocale;
[2075] Fix | Delete
}
[2076] Fix | Delete
[2077] Fix | Delete
function loadLocale(name) {
[2078] Fix | Delete
var oldLocale = null,
[2079] Fix | Delete
aliasedRequire;
[2080] Fix | Delete
// TODO: Find a better way to register and load all the locales in Node
[2081] Fix | Delete
if (
[2082] Fix | Delete
locales[name] === undefined &&
[2083] Fix | Delete
typeof module !== 'undefined' &&
[2084] Fix | Delete
module &&
[2085] Fix | Delete
module.exports
[2086] Fix | Delete
) {
[2087] Fix | Delete
try {
[2088] Fix | Delete
oldLocale = globalLocale._abbr;
[2089] Fix | Delete
aliasedRequire = require;
[2090] Fix | Delete
aliasedRequire('./locale/' + name);
[2091] Fix | Delete
getSetGlobalLocale(oldLocale);
[2092] Fix | Delete
} catch (e) {
[2093] Fix | Delete
// mark as not found to avoid repeating expensive file require call causing high CPU
[2094] Fix | Delete
// when trying to find en-US, en_US, en-us for every format call
[2095] Fix | Delete
locales[name] = null; // null means not found
[2096] Fix | Delete
}
[2097] Fix | Delete
}
[2098] Fix | Delete
return locales[name];
[2099] Fix | Delete
}
[2100] Fix | Delete
[2101] Fix | Delete
// This function will load locale and then set the global locale. If
[2102] Fix | Delete
// no arguments are passed in, it will simply return the current global
[2103] Fix | Delete
// locale key.
[2104] Fix | Delete
function getSetGlobalLocale(key, values) {
[2105] Fix | Delete
var data;
[2106] Fix | Delete
if (key) {
[2107] Fix | Delete
if (isUndefined(values)) {
[2108] Fix | Delete
data = getLocale(key);
[2109] Fix | Delete
} else {
[2110] Fix | Delete
data = defineLocale(key, values);
[2111] Fix | Delete
}
[2112] Fix | Delete
[2113] Fix | Delete
if (data) {
[2114] Fix | Delete
// moment.duration._locale = moment._locale = data;
[2115] Fix | Delete
globalLocale = data;
[2116] Fix | Delete
} else {
[2117] Fix | Delete
if (typeof console !== 'undefined' && console.warn) {
[2118] Fix | Delete
//warn user if arguments are passed but the locale could not be set
[2119] Fix | Delete
console.warn(
[2120] Fix | Delete
'Locale ' + key + ' not found. Did you forget to load it?'
[2121] Fix | Delete
);
[2122] Fix | Delete
}
[2123] Fix | Delete
}
[2124] Fix | Delete
}
[2125] Fix | Delete
[2126] Fix | Delete
return globalLocale._abbr;
[2127] Fix | Delete
}
[2128] Fix | Delete
[2129] Fix | Delete
function defineLocale(name, config) {
[2130] Fix | Delete
if (config !== null) {
[2131] Fix | Delete
var locale,
[2132] Fix | Delete
parentConfig = baseConfig;
[2133] Fix | Delete
config.abbr = name;
[2134] Fix | Delete
if (locales[name] != null) {
[2135] Fix | Delete
deprecateSimple(
[2136] Fix | Delete
'defineLocaleOverride',
[2137] Fix | Delete
'use moment.updateLocale(localeName, config) to change ' +
[2138] Fix | Delete
'an existing locale. moment.defineLocale(localeName, ' +
[2139] Fix | Delete
'config) should only be used for creating a new locale ' +
[2140] Fix | Delete
'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
[2141] Fix | Delete
);
[2142] Fix | Delete
parentConfig = locales[name]._config;
[2143] Fix | Delete
} else if (config.parentLocale != null) {
[2144] Fix | Delete
if (locales[config.parentLocale] != null) {
[2145] Fix | Delete
parentConfig = locales[config.parentLocale]._config;
[2146] Fix | Delete
} else {
[2147] Fix | Delete
locale = loadLocale(config.parentLocale);
[2148] Fix | Delete
if (locale != null) {
[2149] Fix | Delete
parentConfig = locale._config;
[2150] Fix | Delete
} else {
[2151] Fix | Delete
if (!localeFamilies[config.parentLocale]) {
[2152] Fix | Delete
localeFamilies[config.parentLocale] = [];
[2153] Fix | Delete
}
[2154] Fix | Delete
localeFamilies[config.parentLocale].push({
[2155] Fix | Delete
name: name,
[2156] Fix | Delete
config: config,
[2157] Fix | Delete
});
[2158] Fix | Delete
return null;
[2159] Fix | Delete
}
[2160] Fix | Delete
}
[2161] Fix | Delete
}
[2162] Fix | Delete
locales[name] = new Locale(mergeConfigs(parentConfig, config));
[2163] Fix | Delete
[2164] Fix | Delete
if (localeFamilies[name]) {
[2165] Fix | Delete
localeFamilies[name].forEach(function (x) {
[2166] Fix | Delete
defineLocale(x.name, x.config);
[2167] Fix | Delete
});
[2168] Fix | Delete
}
[2169] Fix | Delete
[2170] Fix | Delete
// backwards compat for now: also set the locale
[2171] Fix | Delete
// make sure we set the locale AFTER all child locales have been
[2172] Fix | Delete
// created, so we won't end up with the child locale set.
[2173] Fix | Delete
getSetGlobalLocale(name);
[2174] Fix | Delete
[2175] Fix | Delete
return locales[name];
[2176] Fix | Delete
} else {
[2177] Fix | Delete
// useful for testing
[2178] Fix | Delete
delete locales[name];
[2179] Fix | Delete
return null;
[2180] Fix | Delete
}
[2181] Fix | Delete
}
[2182] Fix | Delete
[2183] Fix | Delete
function updateLocale(name, config) {
[2184] Fix | Delete
if (config != null) {
[2185] Fix | Delete
var locale,
[2186] Fix | Delete
tmpLocale,
[2187] Fix | Delete
parentConfig = baseConfig;
[2188] Fix | Delete
[2189] Fix | Delete
if (locales[name] != null && locales[name].parentLocale != null) {
[2190] Fix | Delete
// Update existing child locale in-place to avoid memory-leaks
[2191] Fix | Delete
locales[name].set(mergeConfigs(locales[name]._config, config));
[2192] Fix | Delete
} else {
[2193] Fix | Delete
// MERGE
[2194] Fix | Delete
tmpLocale = loadLocale(name);
[2195] Fix | Delete
if (tmpLocale != null) {
[2196] Fix | Delete
parentConfig = tmpLocale._config;
[2197] Fix | Delete
}
[2198] Fix | Delete
config = mergeConfigs(parentConfig, config);
[2199] Fix | Delete
if (tmpLocale == null) {
[2200] Fix | Delete
// updateLocale is called for creating a new locale
[2201] Fix | Delete
// Set abbr so it will have a name (getters return
[2202] Fix | Delete
// undefined otherwise).
[2203] Fix | Delete
config.abbr = name;
[2204] Fix | Delete
}
[2205] Fix | Delete
locale = new Locale(config);
[2206] Fix | Delete
locale.parentLocale = locales[name];
[2207] Fix | Delete
locales[name] = locale;
[2208] Fix | Delete
}
[2209] Fix | Delete
[2210] Fix | Delete
// backwards compat for now: also set the locale
[2211] Fix | Delete
getSetGlobalLocale(name);
[2212] Fix | Delete
} else {
[2213] Fix | Delete
// pass null for config to unupdate, useful for tests
[2214] Fix | Delete
if (locales[name] != null) {
[2215] Fix | Delete
if (locales[name].parentLocale != null) {
[2216] Fix | Delete
locales[name] = locales[name].parentLocale;
[2217] Fix | Delete
if (name === getSetGlobalLocale()) {
[2218] Fix | Delete
getSetGlobalLocale(name);
[2219] Fix | Delete
}
[2220] Fix | Delete
} else if (locales[name] != null) {
[2221] Fix | Delete
delete locales[name];
[2222] Fix | Delete
}
[2223] Fix | Delete
}
[2224] Fix | Delete
}
[2225] Fix | Delete
return locales[name];
[2226] Fix | Delete
}
[2227] Fix | Delete
[2228] Fix | Delete
// returns locale data
[2229] Fix | Delete
function getLocale(key) {
[2230] Fix | Delete
var locale;
[2231] Fix | Delete
[2232] Fix | Delete
if (key && key._locale && key._locale._abbr) {
[2233] Fix | Delete
key = key._locale._abbr;
[2234] Fix | Delete
}
[2235] Fix | Delete
[2236] Fix | Delete
if (!key) {
[2237] Fix | Delete
return globalLocale;
[2238] Fix | Delete
}
[2239] Fix | Delete
[2240] Fix | Delete
if (!isArray(key)) {
[2241] Fix | Delete
//short-circuit everything else
[2242] Fix | Delete
locale = loadLocale(key);
[2243] Fix | Delete
if (locale) {
[2244] Fix | Delete
return locale;
[2245] Fix | Delete
}
[2246] Fix | Delete
key = [key];
[2247] Fix | Delete
}
[2248] Fix | Delete
[2249] Fix | Delete
return chooseLocale(key);
[2250] Fix | Delete
}
[2251] Fix | Delete
[2252] Fix | Delete
function listLocales() {
[2253] Fix | Delete
return keys(locales);
[2254] Fix | Delete
}
[2255] Fix | Delete
[2256] Fix | Delete
function checkOverflow(m) {
[2257] Fix | Delete
var overflow,
[2258] Fix | Delete
a = m._a;
[2259] Fix | Delete
[2260] Fix | Delete
if (a && getParsingFlags(m).overflow === -2) {
[2261] Fix | Delete
overflow =
[2262] Fix | Delete
a[MONTH] < 0 || a[MONTH] > 11
[2263] Fix | Delete
? MONTH
[2264] Fix | Delete
: a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
[2265] Fix | Delete
? DATE
[2266] Fix | Delete
: a[HOUR] < 0 ||
[2267] Fix | Delete
a[HOUR] > 24 ||
[2268] Fix | Delete
(a[HOUR] === 24 &&
[2269] Fix | Delete
(a[MINUTE] !== 0 ||
[2270] Fix | Delete
a[SECOND] !== 0 ||
[2271] Fix | Delete
a[MILLISECOND] !== 0))
[2272] Fix | Delete
? HOUR
[2273] Fix | Delete
: a[MINUTE] < 0 || a[MINUTE] > 59
[2274] Fix | Delete
? MINUTE
[2275] Fix | Delete
: a[SECOND] < 0 || a[SECOND] > 59
[2276] Fix | Delete
? SECOND
[2277] Fix | Delete
: a[MILLISECOND] < 0 || a[MILLISECOND] > 999
[2278] Fix | Delete
? MILLISECOND
[2279] Fix | Delete
: -1;
[2280] Fix | Delete
[2281] Fix | Delete
if (
[2282] Fix | Delete
getParsingFlags(m)._overflowDayOfYear &&
[2283] Fix | Delete
(overflow < YEAR || overflow > DATE)
[2284] Fix | Delete
) {
[2285] Fix | Delete
overflow = DATE;
[2286] Fix | Delete
}
[2287] Fix | Delete
if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
[2288] Fix | Delete
overflow = WEEK;
[2289] Fix | Delete
}
[2290] Fix | Delete
if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
[2291] Fix | Delete
overflow = WEEKDAY;
[2292] Fix | Delete
}
[2293] Fix | Delete
[2294] Fix | Delete
getParsingFlags(m).overflow = overflow;
[2295] Fix | Delete
}
[2296] Fix | Delete
[2297] Fix | Delete
return m;
[2298] Fix | Delete
}
[2299] Fix | Delete
[2300] Fix | Delete
// iso 8601 regex
[2301] Fix | Delete
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
[2302] Fix | Delete
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
[2303] Fix | Delete
basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
[2304] Fix | Delete
tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
[2305] Fix | Delete
isoDates = [
[2306] Fix | Delete
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
[2307] Fix | Delete
['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
[2308] Fix | Delete
['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
[2309] Fix | Delete
['GGGG-[W]WW', /\d{4}-W\d\d/, false],
[2310] Fix | Delete
['YYYY-DDD', /\d{4}-\d{3}/],
[2311] Fix | Delete
['YYYY-MM', /\d{4}-\d\d/, false],
[2312] Fix | Delete
['YYYYYYMMDD', /[+-]\d{10}/],
[2313] Fix | Delete
['YYYYMMDD', /\d{8}/],
[2314] Fix | Delete
['GGGG[W]WWE', /\d{4}W\d{3}/],
[2315] Fix | Delete
['GGGG[W]WW', /\d{4}W\d{2}/, false],
[2316] Fix | Delete
['YYYYDDD', /\d{7}/],
[2317] Fix | Delete
['YYYYMM', /\d{6}/, false],
[2318] Fix | Delete
['YYYY', /\d{4}/, false],
[2319] Fix | Delete
],
[2320] Fix | Delete
// iso time formats and regexes
[2321] Fix | Delete
isoTimes = [
[2322] Fix | Delete
['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
[2323] Fix | Delete
['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
[2324] Fix | Delete
['HH:mm:ss', /\d\d:\d\d:\d\d/],
[2325] Fix | Delete
['HH:mm', /\d\d:\d\d/],
[2326] Fix | Delete
['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
[2327] Fix | Delete
['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
[2328] Fix | Delete
['HHmmss', /\d\d\d\d\d\d/],
[2329] Fix | Delete
['HHmm', /\d\d\d\d/],
[2330] Fix | Delete
['HH', /\d\d/],
[2331] Fix | Delete
],
[2332] Fix | Delete
aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
[2333] Fix | Delete
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
[2334] Fix | Delete
rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
[2335] Fix | Delete
obsOffsets = {
[2336] Fix | Delete
UT: 0,
[2337] Fix | Delete
GMT: 0,
[2338] Fix | Delete
EDT: -4 * 60,
[2339] Fix | Delete
EST: -5 * 60,
[2340] Fix | Delete
CDT: -5 * 60,
[2341] Fix | Delete
CST: -6 * 60,
[2342] Fix | Delete
MDT: -6 * 60,
[2343] Fix | Delete
MST: -7 * 60,
[2344] Fix | Delete
PDT: -7 * 60,
[2345] Fix | Delete
PST: -8 * 60,
[2346] Fix | Delete
};
[2347] Fix | Delete
[2348] Fix | Delete
// date from iso format
[2349] Fix | Delete
function configFromISO(config) {
[2350] Fix | Delete
var i,
[2351] Fix | Delete
l,
[2352] Fix | Delete
string = config._i,
[2353] Fix | Delete
match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
[2354] Fix | Delete
allowTime,
[2355] Fix | Delete
dateFormat,
[2356] Fix | Delete
timeFormat,
[2357] Fix | Delete
tzFormat;
[2358] Fix | Delete
[2359] Fix | Delete
if (match) {
[2360] Fix | Delete
getParsingFlags(config).iso = true;
[2361] Fix | Delete
[2362] Fix | Delete
for (i = 0, l = isoDates.length; i < l; i++) {
[2363] Fix | Delete
if (isoDates[i][1].exec(match[1])) {
[2364] Fix | Delete
dateFormat = isoDates[i][0];
[2365] Fix | Delete
allowTime = isoDates[i][2] !== false;
[2366] Fix | Delete
break;
[2367] Fix | Delete
}
[2368] Fix | Delete
}
[2369] Fix | Delete
if (dateFormat == null) {
[2370] Fix | Delete
config._isValid = false;
[2371] Fix | Delete
return;
[2372] Fix | Delete
}
[2373] Fix | Delete
if (match[3]) {
[2374] Fix | Delete
for (i = 0, l = isoTimes.length; i < l; i++) {
[2375] Fix | Delete
if (isoTimes[i][1].exec(match[3])) {
[2376] Fix | Delete
// match[2] should be 'T' or space
[2377] Fix | Delete
timeFormat = (match[2] || ' ') + isoTimes[i][0];
[2378] Fix | Delete
break;
[2379] Fix | Delete
}
[2380] Fix | Delete
}
[2381] Fix | Delete
if (timeFormat == null) {
[2382] Fix | Delete
config._isValid = false;
[2383] Fix | Delete
return;
[2384] Fix | Delete
}
[2385] Fix | Delete
}
[2386] Fix | Delete
if (!allowTime && timeFormat != null) {
[2387] Fix | Delete
config._isValid = false;
[2388] Fix | Delete
return;
[2389] Fix | Delete
}
[2390] Fix | Delete
if (match[4]) {
[2391] Fix | Delete
if (tzRegex.exec(match[4])) {
[2392] Fix | Delete
tzFormat = 'Z';
[2393] Fix | Delete
} else {
[2394] Fix | Delete
config._isValid = false;
[2395] Fix | Delete
return;
[2396] Fix | Delete
}
[2397] Fix | Delete
}
[2398] Fix | Delete
config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
[2399] Fix | Delete
configFromStringAndFormat(config);
[2400] Fix | Delete
} else {
[2401] Fix | Delete
config._isValid = false;
[2402] Fix | Delete
}
[2403] Fix | Delete
}
[2404] Fix | Delete
[2405] Fix | Delete
function extractFromRFC2822Strings(
[2406] Fix | Delete
yearStr,
[2407] Fix | Delete
monthStr,
[2408] Fix | Delete
dayStr,
[2409] Fix | Delete
hourStr,
[2410] Fix | Delete
minuteStr,
[2411] Fix | Delete
secondStr
[2412] Fix | Delete
) {
[2413] Fix | Delete
var result = [
[2414] Fix | Delete
untruncateYear(yearStr),
[2415] Fix | Delete
defaultLocaleMonthsShort.indexOf(monthStr),
[2416] Fix | Delete
parseInt(dayStr, 10),
[2417] Fix | Delete
parseInt(hourStr, 10),
[2418] Fix | Delete
parseInt(minuteStr, 10),
[2419] Fix | Delete
];
[2420] Fix | Delete
[2421] Fix | Delete
if (secondStr) {
[2422] Fix | Delete
result.push(parseInt(secondStr, 10));
[2423] Fix | Delete
}
[2424] Fix | Delete
[2425] Fix | Delete
return result;
[2426] Fix | Delete
}
[2427] Fix | Delete
[2428] Fix | Delete
function untruncateYear(yearStr) {
[2429] Fix | Delete
var year = parseInt(yearStr, 10);
[2430] Fix | Delete
if (year <= 49) {
[2431] Fix | Delete
return 2000 + year;
[2432] Fix | Delete
} else if (year <= 999) {
[2433] Fix | Delete
return 1900 + year;
[2434] Fix | Delete
}
[2435] Fix | Delete
return year;
[2436] Fix | Delete
}
[2437] Fix | Delete
[2438] Fix | Delete
function preprocessRFC2822(s) {
[2439] Fix | Delete
// Remove comments and folding whitespace and replace multiple-spaces with a single space
[2440] Fix | Delete
return s
[2441] Fix | Delete
.replace(/\([^)]*\)|[\n\t]/g, ' ')
[2442] Fix | Delete
.replace(/(\s\s+)/g, ' ')
[2443] Fix | Delete
.replace(/^\s\s*/, '')
[2444] Fix | Delete
.replace(/\s\s*$/, '');
[2445] Fix | Delete
}
[2446] Fix | Delete
[2447] Fix | Delete
function checkWeekday(weekdayStr, parsedInput, config) {
[2448] Fix | Delete
if (weekdayStr) {
[2449] Fix | Delete
// TODO: Replace the vanilla JS Date object with an independent day-of-week check.
[2450] Fix | Delete
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
[2451] Fix | Delete
weekdayActual = new Date(
[2452] Fix | Delete
parsedInput[0],
[2453] Fix | Delete
parsedInput[1],
[2454] Fix | Delete
parsedInput[2]
[2455] Fix | Delete
).getDay();
[2456] Fix | Delete
if (weekdayProvided !== weekdayActual) {
[2457] Fix | Delete
getParsingFlags(config).weekdayMismatch = true;
[2458] Fix | Delete
config._isValid = false;
[2459] Fix | Delete
return false;
[2460] Fix | Delete
}
[2461] Fix | Delete
}
[2462] Fix | Delete
return true;
[2463] Fix | Delete
}
[2464] Fix | Delete
[2465] Fix | Delete
function calculateOffset(obsOffset, militaryOffset, numOffset) {
[2466] Fix | Delete
if (obsOffset) {
[2467] Fix | Delete
return obsOffsets[obsOffset];
[2468] Fix | Delete
} else if (militaryOffset) {
[2469] Fix | Delete
// the only allowed military tz is Z
[2470] Fix | Delete
return 0;
[2471] Fix | Delete
} else {
[2472] Fix | Delete
var hm = parseInt(numOffset, 10),
[2473] Fix | Delete
m = hm % 100,
[2474] Fix | Delete
h = (hm - m) / 100;
[2475] Fix | Delete
return h * 60 + m;
[2476] Fix | Delete
}
[2477] Fix | Delete
}
[2478] Fix | Delete
[2479] Fix | Delete
// date and time from ref 2822 format
[2480] Fix | Delete
function configFromRFC2822(config) {
[2481] Fix | Delete
var match = rfc2822.exec(preprocessRFC2822(config._i)),
[2482] Fix | Delete
parsedArray;
[2483] Fix | Delete
if (match) {
[2484] Fix | Delete
parsedArray = extractFromRFC2822Strings(
[2485] Fix | Delete
match[4],
[2486] Fix | Delete
match[3],
[2487] Fix | Delete
match[2],
[2488] Fix | Delete
match[5],
[2489] Fix | Delete
match[6],
[2490] Fix | Delete
match[7]
[2491] Fix | Delete
);
[2492] Fix | Delete
if (!checkWeekday(match[1], parsedArray, config)) {
[2493] Fix | Delete
return;
[2494] Fix | Delete
}
[2495] Fix | Delete
[2496] Fix | Delete
config._a = parsedArray;
[2497] Fix | Delete
config._tzm = calculateOffset(match[8], match[9], match[10]);
[2498] Fix | Delete
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function