]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
rfc2822 ParsingFlags moved to the bottom of the parsing code.
authorTGJG-XPS\TracyG <tracyg.gilmore@gmail.com>
Mon, 6 Mar 2017 19:52:39 +0000 (19:52 +0000)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 12 Mar 2017 00:11:46 +0000 (02:11 +0200)
src/lib/create/from-string.js

index 8b5c7cd30476e36cf7888e225f02a2d8999ef8fc..b7ba9a740b51bc366238239ed3ca0a06f9cb3267 100644 (file)
@@ -125,7 +125,6 @@ export function configFromRFC2822(config) {
         dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY ');
         timeFormat = 'HH:mm' + (match[4] ? ':ss' : '');
 
-
         // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
         if (match[1]) { // day of week given
             var momentDate = new Date(match[2]);
@@ -137,7 +136,6 @@ export function configFromRFC2822(config) {
                 return;
             }
         }
-        getParsingFlags(config).rfc2822 = true;
 
         switch (match[5].length) {
             case 2: // military
@@ -161,6 +159,7 @@ export function configFromRFC2822(config) {
         tzFormat = ' ZZ';
         config._f = dayFormat + dateFormat + timeFormat + tzFormat;
         configFromStringAndFormat(config);
+        getParsingFlags(config).rfc2822 = true;
     } else {
         config._isValid = false;
     }