Skip to content

Commit 147fe76

Browse files
authored
Merge pull request #53610 from Krishna2323/krishna2323/issue/53427
fix: Distance - No error when editing the default rate to 4 decimal places and creating a same one.
2 parents 034b2d9 + faae31d commit 147fe76

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libs/PolicyDistanceRatesUtils.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ function validateRateValue(
2020
const errors: FormInputErrors<RateValueForm> = {};
2121
const parsedRate = MoneyRequestUtils.replaceAllDigits(values.rate, toLocaleDigit);
2222
const decimalSeparator = toLocaleDigit('.');
23-
const ratesList = Object.values(customUnitRates).filter((rate) => currentRateValue !== rate.rate);
23+
const ratesList = Object.values(customUnitRates)
24+
.filter((rate) => currentRateValue !== rate.rate)
25+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
26+
.map((r) => ({...r, rate: parseFloat(Number(r.rate || 0).toFixed(10))}));
2427
// The following logic replicates the backend's handling of rates:
2528
// - Multiply the rate by 100 (CUSTOM_UNIT_RATE_BASE_OFFSET) to scale it, ensuring precision.
2629
// - This ensures rates are converted as follows:

0 commit comments

Comments
 (0)