From 34af63b8b21208a949dfaf42d228502c73d20ec0 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 2 Feb 2016 18:01:31 +1100 Subject: [PATCH] use full-string match to speed up C# duration match Fixes: https://github.com/moment/moment/issues/2936 --- src/lib/duration/create.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/duration/create.js b/src/lib/duration/create.js index a79feea319..d465cee97c 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