Open lanitochka17 opened 3 days ago
We think that this bug might be related to #vip-vsp
Selected distance amount does not take into account currency decimals.
In the amount form, we don't show the decimals if the currency doesn't support it. This is valid for VND and IQD type of currencies.
But in the other places, we show the exact decimal amount even though the currency doesn't support it.
This needs to be updated.
We can also stop showing the decimals in the main pages:
function convertAmountToDisplayString(amount = 0, currency: string = CONST.CURRENCY.USD): string {
const convertedAmount = amount / 100.0;
return MoneyRequestUtils.stripDecimalsFromAmount(NumberFormatUtils.format(BaseLocaleListener.getPreferredLocale(), convertedAmount, {
style: 'currency',
currency,
minimumFractionDigits: getCurrencyDecimals(currency) + 1,
}));
}
This will fix it wherever convertAmountToDisplayString is used.
We can calculate the convertedAmount like this in convertAmountToDisplayString
which is used at this place:
const convertedAmount = convertToFrontendAmountAsInteger(amount, currency);
And convertToFrontendAmountAsInteger will use the decimals based on currency (this work is already in progress and will be merged soon).
Then, in the amount form we need to use proper decimal count:
Update this:
const decimals = getCurrencyDecimals(currency);
const currentRateValue = (parseFloat((rate?.rate ?? 0).toString()) / CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET).toFixed(decimals !== 0 ? 3 : 0);
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.4 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Selected Distance rate amount (IQD 0.7) must be shown in rate page
Actual Result:
Selected Distance rate amount (IQD 0.7) is not shown in rate page. Rate page shows amount as zero
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/057ca424-7d51-413e-8c31-d6d46e989e3b
View all open jobs on GitHub