From: Rod Vagg Date: Tue, 2 Feb 2016 07:01:31 +0000 (+1100) Subject: use full-string match to speed up C# duration match X-Git-Tag: 2.11.2~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34af63b8b21208a949dfaf42d228502c73d20ec0;p=thirdparty%2Fmoment.git use full-string match to speed up C# duration match Fixes: https://github.com/moment/moment/issues/2936 --- diff --git a/src/lib/duration/create.js b/src/lib/duration/create.js index a79feea31..d465cee97 100644 --- a/src/lib/duration/create.js +++ b/src/lib/duration/create.js @@ -6,7 +6,7 @@ import { cloneWithOffset } from '../units/offset'; import { createLocal } from '../create/local'; // ASP.NET json date format regex -var aspNetRegex = /(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/; +var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/; // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere