MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / configFromRFC2822

Function configFromRFC2822

tests/test_code/js/moment/moment.js:2482–2508  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

2480
2481 // date and time from ref 2822 format
2482 function configFromRFC2822(config) {
2483 var match = rfc2822.exec(preprocessRFC2822(config._i)),
2484 parsedArray;
2485 if (match) {
2486 parsedArray = extractFromRFC2822Strings(
2487 match[4],
2488 match[3],
2489 match[2],
2490 match[5],
2491 match[6],
2492 match[7]
2493 );
2494 if (!checkWeekday(match[1], parsedArray, config)) {
2495 return;
2496 }
2497
2498 config._a = parsedArray;
2499 config._tzm = calculateOffset(match[8], match[9], match[10]);
2500
2501 config._d = createUTCDate.apply(null, config._a);
2502 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
2503
2504 getParsingFlags(config).rfc2822 = true;
2505 } else {
2506 config._isValid = false;
2507 }
2508 }
2509
2510 // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
2511 function configFromString(config) {

Callers 2

configFromStringFunction · 0.85

Calls 6

preprocessRFC2822Function · 0.85
checkWeekdayFunction · 0.85
calculateOffsetFunction · 0.85
getParsingFlagsFunction · 0.85
applyMethod · 0.80

Tested by

no test coverage detected