You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] Distance rates: show amounts with 2 decimals unless more were entered #106594
Distance rate amount editors always show 4 decimals. If an admin enters a rate of 0.1, the table shows $0.10, but editing it shows 0.1000. Three extra zeros look odd on a money amount.
The padding comes from .toFixed(CONST.MAX_TAX_RATE_DECIMAL_PLACES) in:
Sounds fine to me. I feel like I remember us reducing it to two for a reason. I think it makes sense to respect it if an admin has entered more though. I'd think that we should show 4 in the table for all if we show it for one, otherwise I think one number will just look way bigger than the others. No strong feelings here though
Hmm I do remember us increasing the amount of decimal places for the total distance traveled, but I don't recall any changes to the rates.
I think it's actually common to have three decimal place rates (not sure about four) so I think we need to keep that ability. I agree that whatever the user enters is something we should show in the table (no rounding).
Yeah, I seem to recall the IRS rate being three decimals a few years ago - and also some customers using up to 4 decimals for their rates in some territories so we increased what was allowed years ago. Whatever amount of decimals we supported historically in Classic is what we should support in NewDot. I agree with showing what was entered. 👍
I'm aligned as well. Fine with the change and I agree we should show what they entered in the table.
I'd think that we should show 4 in the table for all if we show it for one
I disagree here though if I'm understanding your comment properly. I think we should just display the rate in the table exactly as they entered it (i.e. $0.20, $0.25, $0.2897)
Reacted by Shawn Borton, Jon Dubielzyk and Joseph Kaufman
All four editors initialize amounts using toFixed(4), which pads values such as 0.1 to 0.1000. The four-decimal input limit is correct; the unnecessary padding comes from formatting the initial value.
What changes do you think we should make in order to solve the problem?
Add a shared distance-amount formatter that preserves existing four-decimal rounding, then removes trailing zeros only beyond two decimal places:
0.1 → 0.10
0.123 → 0.123
0.1234 → 0.1234
Use it for both Rate editors and the shared Tax reclaimable helper, covering all four editors. Keep four-decimal entry support, localization, validation, and stored values unchanged.
Normalize both sides of the inline Tax reclaimable unchanged-value comparison so saving 0.10 instead of 0.1000 does not trigger an unnecessary update.
Add regression tests covering all four editors, mixed-precision table rows, save/reopen, unchanged submissions, blank reclaimable values, and government-rate matching.
Table clarification: In the current checkout, both table columns already support two to four decimal places independently per value. Preserve that behavior and add regression coverage rather than changing global currency formatting.
These findings are source-verified; browser behavior has not been tested.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/106594) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Don't add a new formatter. getRateDisplayValue in src/libs/PolicyUtils/customUnits.ts already does the 2–4 decimal "OD Behavior". Extract its withDecimals fraction-digit logic into a helper without the locale separator step, reuse it from getRateDisplayValue, both Rate editors (WorkspaceDistanceRateValueCell, PolicyDistanceRateEditPage), and getTaxClaimableDisplayAmount.
Normalize every unchanged-value check, not only the inline tax one: PolicyDistanceRateEditPage and PolicyDistanceRateTaxReclaimableEditPage compare raw strings with ===, so typing 0.1 when 0.10 is shown resends the same value. Compare numerically at 4 decimals in all four places.
Keep tests at unit level: the new helper, both InlineEdit unchanged checks, and isGovernmentRateUnmodified.
changed the title [-]Distance rates: show amounts with 2 decimals unless more were entered[/-][+][$175] Distance rates: show amounts with 2 decimals unless more were entered[/+]on Nov 13, 2026
📣 @debarkamondal! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
@debarkamondal This one is resolved. If you're interested in contributing to Expensify, you can start by going through the contributing guidelines. Thanks!
Activity
dubielzyk-expensify commentedon Nov 11, 2026
Sounds fine to me. I feel like I remember us reducing it to two for a reason. I think it makes sense to respect it if an admin has entered more though. I'd think that we should show 4 in the table for all if we show it for one, otherwise I think one number will just look way bigger than the others. No strong feelings here though
shawnborton commentedon Nov 11, 2026
Hmm I do remember us increasing the amount of decimal places for the total distance traveled, but I don't recall any changes to the rates.
I think it's actually common to have three decimal place rates (not sure about four) so I think we need to keep that ability. I agree that whatever the user enters is something we should show in the table (no rounding).
trjExpensify commentedon Nov 11, 2026
Yeah, I seem to recall the IRS rate being three decimals a few years ago - and also some customers using up to 4 decimals for their rates in some territories so we increased what was allowed years ago. Whatever amount of decimals we supported historically in Classic is what we should support in NewDot. I agree with showing what was entered. 👍
dannymcclain commentedon Nov 11, 2026
I'm aligned as well. Fine with the change and I agree we should show what they entered in the table.
I disagree here though if I'm understanding your comment properly. I think we should just display the rate in the table exactly as they entered it (i.e.
$0.20,$0.25,$0.2897)Krishna2323 commentedon Nov 12, 2026
@MelvinBot post a proposal
MelvinBot commentedon Nov 12, 2026
Proposal
What is the root cause of that problem?
All four editors initialize amounts using
toFixed(4), which pads values such as0.1to0.1000. The four-decimal input limit is correct; the unnecessary padding comes from formatting the initial value.Code evidence
toFixed(4).What changes do you think we should make in order to solve the problem?
0.1→0.100.123→0.1230.1234→0.12340.10instead of0.1000does not trigger an unnecessary update.Table clarification: In the current checkout, both table columns already support two to four decimal places independently per value. Preserve that behavior and add regression coverage rather than changing global currency formatting.
Compatibility checks
These findings are source-verified; browser behavior has not been tested.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/106594)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
Krishna2323 commentedon Nov 12, 2026
@MelvinBot implement this with these refinements:
getRateDisplayValueinsrc/libs/PolicyUtils/customUnits.tsalready does the 2–4 decimal "OD Behavior". Extract itswithDecimalsfraction-digit logic into a helper without the locale separator step, reuse it fromgetRateDisplayValue, both Rate editors (WorkspaceDistanceRateValueCell,PolicyDistanceRateEditPage), andgetTaxClaimableDisplayAmount.PolicyDistanceRateEditPageandPolicyDistanceRateTaxReclaimableEditPagecompare raw strings with===, so typing0.1when0.10is shown resends the same value. Compare numerically at 4 decimals in all four places.InlineEditunchanged checks, andisGovernmentRateUnmodified.MelvinBot commentedon Nov 12, 2026
Created draft PR: Show distance rate editor amounts with meaningful decimal precision, assigned to
Krishna2323.Implemented all three refinements: reused the existing formatting logic, normalized all four unchanged-value checks, and added unit-level coverage.
Passed: 902 relevant tests, lint, app/test type checks, spelling, component compiler checks, and Storybook smoke test.
Full-suite timeouts and formatter-check limitations are documented in the PR.
view run
[-]Distance rates: show amounts with 2 decimals unless more were entered[/-][+][$175] Distance rates: show amounts with 2 decimals unless more were entered[/+]melvin-bot commentedon Nov 13, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022121298853499942889
debarkamondal commentedon Nov 15, 2026
@Krishna2323 I came to this Issue from Upwork. I can see that a PR has been merged. Is the issue solved or would you like me create a proposal?
Upwork Profile: https://www.upwork.com/freelancers/~01c957006a1e6583da?mp_source=share
melvin-bot commentedon Nov 15, 2026
📣 @debarkamondal! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
debarkamondal commentedon Nov 15, 2026
Contributor details
Your Expensify account email: debarkamondal@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01c957006a1e6583da
melvin-bot commentedon Nov 15, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Krishna2323 commentedon Nov 15, 2026
@debarkamondal This one is resolved. If you're interested in contributing to Expensify, you can start by going through the contributing guidelines. Thanks!