From 30b67ad985e18370ca5309e8ee0800a6f0232c1c Mon Sep 17 00:00:00 2001 From: GandalfGwaihir Date: Thu, 2 May 2024 15:25:46 +0530 Subject: [PATCH] Allow regex verification for only decimal pointer number --- src/libs/PolicyDistanceRatesUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/PolicyDistanceRatesUtils.ts b/src/libs/PolicyDistanceRatesUtils.ts index edc5e51ceeb9..db739cc3b8c7 100644 --- a/src/libs/PolicyDistanceRatesUtils.ts +++ b/src/libs/PolicyDistanceRatesUtils.ts @@ -15,7 +15,7 @@ function validateRateValue(values: FormOnyxValues, currency: stri const decimalSeparator = toLocaleDigit('.'); // Allow one more decimal place for accuracy - const rateValueRegex = RegExp(String.raw`^-?\d{0,8}([${getPermittedDecimalSeparator(decimalSeparator)}]\d{1,${CurrencyUtils.getCurrencyDecimals(currency) + 1}})?$`, 'i'); + const rateValueRegex = RegExp(String.raw`^-?\d{0,8}([${getPermittedDecimalSeparator(decimalSeparator)}]\d{0,${CurrencyUtils.getCurrencyDecimals(currency) + 1}})?$`, 'i'); if (!rateValueRegex.test(parsedRate) || parsedRate === '') { errors.rate = 'workspace.reimburse.invalidRateError'; } else if (NumberUtils.parseFloatAnyLocale(parsedRate) <= 0) {