From 78c1d2b2b99f1dd390e43d067f06cf77e5d29c6d Mon Sep 17 00:00:00 2001 From: Alice Khoudli Date: Tue, 26 Nov 2024 16:05:05 +0100 Subject: [PATCH] front: handle stopfor input with unit in timesstops table Signed-off-by: Alice Khoudli --- front/src/modules/timesStops/helpers/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/front/src/modules/timesStops/helpers/utils.ts b/front/src/modules/timesStops/helpers/utils.ts index a280f9d7bf6..7a7b8792db8 100644 --- a/front/src/modules/timesStops/helpers/utils.ts +++ b/front/src/modules/timesStops/helpers/utils.ts @@ -193,6 +193,10 @@ export function updateRowTimesAndMargin( newRowData.theoreticalMargin = '0%'; } } + // Remove second unit in stopFor if inputted by mistake + if (newRowData.stopFor && /^[0-9]+ *s$/i.test(newRowData.stopFor)) { + newRowData.stopFor = newRowData.stopFor.replace(/ *s$/i, ''); + } return newRowData; }