]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
among invalid moments, prefer the first one, regardless of score
authorIsaac Cambron <isaac@isaaccambron.com>
Fri, 27 Sep 2013 21:37:55 +0000 (17:37 -0400)
committerIsaac Cambron <isaac@isaaccambron.com>
Fri, 27 Sep 2013 21:37:55 +0000 (17:37 -0400)
moment.js
test/moment/create.js

index e080bbdfb460e81b264307165a176d9bc6b77506..18863fe7bbf9993ffdde54e2db4eb450865fd8c4 100644 (file)
--- a/moment.js
+++ b/moment.js
             makeDateFromStringAndFormat(tempConfig);
 
             if (!isValid(tempConfig)) {
-                currentScore += 100;
+                continue;
             }
 
             // if there is any input that was not parsed add a penalty for that format
index 3051136781a113424d03b66d53677b0bb9c3e813..1b82f06cf7baee5b202e1b4b2a7986ca241d6694 100644 (file)
@@ -329,8 +329,8 @@ exports.create = {
 
         test.equal(moment('11-02-10', ['MM.DD.YY', 'DD-MM-YY']).format('MM DD YYYY'), '02 11 2010', 'escape RegExp special characters on comparing');
 
-        test.equal(moment('13-14-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year');
-        test.equal(moment('13-14-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year');
+        test.equal(moment('13-10-98', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YY', 'use two digit year');
+        test.equal(moment('13-10-1998', ['DD MM YY', 'DD MM YYYY'])._f, 'DD MM YYYY', 'use four digit year');
 
         test.equal(moment('01', ["MM", "DD"])._f, "MM", "Should use first valid format");