From e390a15c1cb5543e954701eb6b93714437b42fb5 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Wed, 14 Jun 2017 13:56:16 +0530 Subject: [PATCH] Updated regex to support + sign in between the string --- 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 656fb2337..e6d51cd7d 100644 --- a/src/lib/duration/create.js +++ b/src/lib/duration/create.js @@ -14,7 +14,7 @@ var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\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 // and further modified to allow for strings containing both week and day -var isoRegex = /^(-|\+)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; +var isoRegex = /^(-|\+)?P(?:((?:-|\+)?[0-9,.]*)Y)?(?:((?:-|\+)?[0-9,.]*)M)?(?:((?:-|\+)?[0-9,.]*)W)?(?:((?:-|\+)?[0-9,.]*)D)?(?:T(?:((?:-|\+)?[0-9,.]*)H)?(?:((?:-|\+)?[0-9,.]*)M)?(?:((?:-|\+)?[0-9,.]*)S)?)?$/; export function createDuration (input, key) { var duration = input, -- 2.47.2