From db13014d0aee87402afc2289131d65c401f71bfe Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Mon, 2 Dec 2019 16:24:58 +0100 Subject: [PATCH] Fix extractTime() function --- client/src/utils/timeControl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/utils/timeControl.js b/client/src/utils/timeControl.js index 194deaf6..3f5a6506 100644 --- a/client/src/utils/timeControl.js +++ b/client/src/utils/timeControl.js @@ -26,11 +26,11 @@ export function extractTime(timeControl) // Concatenate usual time control suffixes, in case of none is provided tcParts[0] += "m"; tcParts[1] += "s"; - const mainTimeArray = tcParts[0].match(/([0-9]+)([smhd]+)/); + const mainTimeArray = tcParts[0].match(/([0-9]+)([smhd]+)/); if (!mainTimeArray) return null; const mainTimeValue = parseInt(mainTimeArray[1]); - const mainTimeUnit = mainTimeArray[2]; + const mainTimeUnit = mainTimeArray[2][0]; const mainTime = timeUnitToSeconds(mainTimeValue, mainTimeUnit); let increment = 0; if (tcParts.length >= 2) @@ -39,7 +39,7 @@ export function extractTime(timeControl) if (!incrementArray) return null; const incrementValue = parseInt(incrementArray[1]); - const incrementUnit = incrementArray[2]; + const incrementUnit = incrementArray[2][0]; // Increment unit cannot be larger than main unit: if (isLargerUnit(incrementUnit, mainTimeUnit)) return null; -- 2.44.0