From: Iskren Chernev Date: Wed, 2 Apr 2014 07:22:44 +0000 (-0700) Subject: Fix iso parsing with more than 3 subsecond digits X-Git-Tag: 2.6.0~18^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=739f9bc0d9af4fd658d393b9b52230a665217561;p=thirdparty%2Fmoment.git Fix iso parsing with more than 3 subsecond digits --- diff --git a/moment.js b/moment.js index b059e0a82..cd6f2add2 100644 --- 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/] diff --git a/test/moment/create.js b/test/moment/create.js index c0a3a606c..185ef9494 100644 --- a/test/moment/create.js +++ b/test/moment/create.js @@ -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");