]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fixing ISO-8601 date parsing when no time component is present.
authorPhil Johnson <phil.johnson789@gmail.com>
Thu, 4 Jun 2015 20:48:51 +0000 (16:48 -0400)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 13 Jul 2015 00:14:29 +0000 (17:14 -0700)
src/lib/create/from-string.js

index 4bd6d5913810014eed4f045f16c9e2d7069869b6..4a7163b2d68859c6f08f835063274cc5a8769b6a 100644 (file)
@@ -36,14 +36,14 @@ export function configFromISO(config) {
         getParsingFlags(config).iso = true;
         for (i = 0, l = isoDates.length; i < l; i++) {
             if (isoDates[i][1].exec(string)) {
-                // match[5] should be 'T' or undefined
-                config._f = isoDates[i][0] + (match[6] || ' ');
+                config._f = isoDates[i][0];
                 break;
             }
         }
         for (i = 0, l = isoTimes.length; i < l; i++) {
             if (isoTimes[i][1].exec(string)) {
-                config._f += isoTimes[i][0];
+                // match[6] should be 'T' or space
+                config._f += (match[6] || ' ') + isoTimes[i][0];
                 break;
             }
         }