]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Parsing flag weekdayMismatch added and applied to the RFC parse validation.
authorTGJG-XPS\TracyG <tracyg.gilmore@gmail.com>
Tue, 14 Feb 2017 17:38:53 +0000 (17:38 +0000)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 12 Mar 2017 00:11:46 +0000 (02:11 +0200)
src/lib/create/from-string.js
src/lib/create/parsing-flags.js

index c07481ae04ebefd9af87f88767c9a2240b508052..842bd3b4bff7800265b43da34ee1e0c761ddee80 100644 (file)
@@ -160,12 +160,14 @@ 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]);
             var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()];
-
+            
             if (match[1].substr(0,3) !== momentDay) {
+                getParsingFlags(config).weekdayMismatch = true;
                 config._isValid = false;
                 return;
             }
index 8f1cf4332bfb2f6af3b18433839fb0299bd23509..6c948b6e18a3bdb7408e297976e018ff3c22f588 100644 (file)
@@ -13,7 +13,8 @@ function defaultParsingFlags() {
         iso             : false,
         parsedDateParts : [],
         meridiem        : null,
-        rfc2822                        : false
+        rfc2822                        : false,
+        weekdayMismatch : false
     };
 }