From 2b2a5232f3164fe3e327a2e55003eba95b3834c1 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Fri, 22 Mar 2024 12:00:49 -0600 Subject: [PATCH] fix off by one error --- 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 8870609e2c47..edc5e51ceeb9 100644 --- a/src/libs/PolicyDistanceRatesUtils.ts +++ b/src/libs/PolicyDistanceRatesUtils.ts @@ -30,7 +30,7 @@ function validateRateValue(values: FormOnyxValues, currency: stri */ function getOptimisticRateName(rates: Record): string { const existingRatesWithSameName = Object.values(rates ?? {}).filter((rate) => (rate.name ?? '').startsWith(CONST.CUSTOM_UNITS.DEFAULT_RATE)); - return existingRatesWithSameName.length ? `${CONST.CUSTOM_UNITS.DEFAULT_RATE} ${existingRatesWithSameName.length + 1}` : CONST.CUSTOM_UNITS.DEFAULT_RATE; + return existingRatesWithSameName.length ? `${CONST.CUSTOM_UNITS.DEFAULT_RATE} ${existingRatesWithSameName.length}` : CONST.CUSTOM_UNITS.DEFAULT_RATE; } export {validateRateValue, getOptimisticRateName};