]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix iso parsing with more than 3 subsecond digits 1578/head
authorIskren Chernev <iskren.chernev@gmail.com>
Wed, 2 Apr 2014 07:22:44 +0000 (00:22 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Wed, 2 Apr 2014 07:22:44 +0000 (00:22 -0700)
moment.js
test/moment/create.js

index b059e0a8230210dbeb68efebb8acdcc6a30ea5c9..cd6f2add2f5516978368abb5f243a5356c3c2efe 100644 (file)
--- a/moment.js
+++ b/moment.js
@@ -91,7 +91,7 @@
 
         // iso time formats and regexes
         isoTimes = [
-            ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d{1,3}/],
+            ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
             ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
             ['HH:mm', /(T| )\d\d:\d\d/],
             ['HH', /(T| )\d\d/]
index c0a3a606c5ea76b31504f2fff8f36f2c9a9d68ff..185ef9494145dc215eea39a7cbec8e1f114714c8 100644 (file)
@@ -600,6 +600,12 @@ exports.create = {
         test.done();
     },
 
+    "parsing iso with more subsecond precision digits" : function (test) {
+        test.equal(moment.utc("2013-07-31T22:00:00.0000000Z").format(),
+                "2013-07-31T22:00:00+00:00", "more than 3 subsecond digits");
+        test.done();
+    },
+
     "null or empty" : function (test) {
         test.expect(8);
         test.equal(moment('').isValid(), false, "moment('') is not valid");