]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
rerolled to modify `aspNetTimeSpanJsonRegex` rather than introduce a new regex pattern 1059/head
authorIan W. Remmel <engineering@ianwremmel.com>
Fri, 13 Sep 2013 23:18:59 +0000 (19:18 -0400)
committerIan W. Remmel <engineering@ianwremmel.com>
Fri, 13 Sep 2013 23:18:59 +0000 (19:18 -0400)
moment.js

index 69b96409c10ce18f80ae3c4d72f13ddb03dd822d..1dd866f030da539cc34ca745a2defa821eddf8c2 100644 (file)
--- a/moment.js
+++ b/moment.js
@@ -21,9 +21,7 @@
 
         // ASP.NET json date format regex
         aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
-        aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)\:(\d+)\.?(\d{3})?/,
-
-    twentyFourHourTimeRegex = /(\d{2})\:(\d{2})/,
+        aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
 
         // format tokens
         formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,
             isNumber = (typeof input === 'number'),
             duration = (isDuration ? input._input : (isNumber ? {} : input)),
             matched = aspNetTimeSpanJsonRegex.exec(input),
-        twentyFourHourMatched = twentyFourHourTimeRegex.exec(input),
             sign,
             ret;
 
                 s: ~~matched[5] * sign,
                 ms: ~~matched[6] * sign
             };
-        } else if (twentyFourHourMatched) {
-            duration = {
-                y: 0,
-                d: 0,
-                h: ~~twentyFourHourMatched[1],
-                m: ~~twentyFourHourMatched[2],
-                s: 0,
-                ms: 0
-            };
         }
 
         ret = new Duration(duration);