feat: increase max allowed number of digits for manual expenses - #80163
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request increases the maximum allowed number of digits for manual expense amounts from 8 to 10 digits, addressing issue #78643. The change enables users to enter larger monetary amounts when creating manual expenses.
Changes:
- Updated the
AMOUNT_MAX_LENGTHconstant from 8 to 10 - Modified input masks and validation regex patterns across multiple components to support 10-digit amounts
- Updated all related test cases to reflect the new limit
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/CONST/index.ts |
Increased AMOUNT_MAX_LENGTH constant from 8 to 10 |
src/components/AmountWithoutCurrencyInput.tsx |
Updated input mask patterns and validation regex to allow 10 digits |
src/libs/SearchAutocompleteUtils.ts |
Updated amount validation regex to support 10-digit amounts |
src/libs/PolicyDistanceRatesUtils.ts |
Updated rate value validation regex to allow 10 digits |
src/pages/ReimbursementAccount/USD/ConnectBankAccount/components/BankAccountValidationForm.tsx |
Updated amount validation regex to support 10 digits |
tests/unit/MoneyRequestUtilsTest.ts |
Updated test cases to validate 10-digit amounts and edge cases |
tests/unit/SearchAutocompleteUtilsTest.ts |
Updated test to verify 10-digit limit for amount filters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
trjExpensify
left a comment
There was a problem hiding this comment.
Makes sense that we're consistent with Classic here 👍
| const amountValues = getAmountValues(values); | ||
| const outputCurrency = policy?.outputCurrency ?? CONST.CURRENCY.USD; | ||
| const amountRegex = RegExp(String.raw`^-?\d{0,8}([${permittedDecimalSeparator}]\d{0,${getCurrencyDecimals(outputCurrency)}})?$`, 'i'); | ||
| const amountRegex = RegExp(String.raw`^-?\d{0,10}([${permittedDecimalSeparator}]\d{0,${getCurrencyDecimals(outputCurrency)}})?$`, 'i'); |
There was a problem hiding this comment.
Could you please update number 10 to reuse AMOUNT_MAX_LENGTH, and apply it in other places as well?
There was a problem hiding this comment.
@samranahm I still see some places where the value 10 is used instead of AMOUNT_MAX_LENGTH. Could you please check again?
There was a problem hiding this comment.
Ahh my bad, I missed some places. Updating now
| TRACK: 'track', | ||
| }, | ||
| AMOUNT_MAX_LENGTH: 8, | ||
| AMOUNT_MAX_LENGTH: 10, |
There was a problem hiding this comment.
Please check this as well. Since AMOUNT_MAX_LENGTH is now 10, the old logic to add 2 is no longer necessary.
App/src/libs/SearchQueryUtils.ts
Lines 901 to 913 in d2334c9
There was a problem hiding this comment.
Absolutely, updated.
|
All test passing, all your @linhvovan29546 |
|
@samranahm The changes in this PR also impact other areas. Please add additional test steps to the description or relevant notes so that QA can verify these changes when deploying to staging.
|
|
Agree, I'll add more relevant test steps shortly based on impact on product. |
|
@linhvovan29546 I've updated the QA steps. Thanks for highlighting this. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-01-26.at.09.54.25.movAndroid: mWeb ChromeScreen.Recording.2026-01-26.at.09.49.05.moviOS: HybridAppScreen.Recording.2026-01-26.at.09.58.38.moviOS: mWeb SafariScreen.Recording.2026-01-26.at.10.01.35.movMacOS: Chrome / SafariScreen.Recording.2026-01-26.at.09.44.15.movScreen.Recording.2026-01-26.at.09.29.33.mov |
| filtersForm[equalToKey] = | ||
| filterList | ||
| .find((filter) => filter.operator === CONST.SEARCH.SYNTAX_OPERATORS.EQUAL_TO && validateAmount(filter.value.toString(), 0, CONST.IOU.AMOUNT_MAX_LENGTH + 2, true)) | ||
| .find((filter) => filter.operator === CONST.SEARCH.SYNTAX_OPERATORS.EQUAL_TO && validateAmount(filter.value.toString(), 0, CONST.IOU.AMOUNT_MAX_LENGTH, true)) |
There was a problem hiding this comment.
@samranahm Sorry, but I think we need to add the + 2 again. Without it, we encounter an issue: if you enter 10 digits, the filter isn’t displayed. I was mistaken about my previous comment: "backend amount is an integer and is 2 digits longer than frontend amount."
I think we can update it to: backend converts the amount to cents, and the maximum is 12 digits.
Screen.Recording.2026-01-26.at.09.29.33.mov
There was a problem hiding this comment.
You're absolutely right! The backend converts amounts to cents by multiplying by 100, which effectively adds 2 digits to the value. So while the frontend max is 10 digits, the backend can handle up to 12 digits. We should add the +2 back.
There was a problem hiding this comment.
Updated.
Search.query.mp4
|
@Julesssss All yours |
|
@Julesssss Gentle bump. |
|
Sorry, was away last week. |
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.3.11-19 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|
| TRACK: 'track', | ||
| }, | ||
| AMOUNT_MAX_LENGTH: 8, | ||
| AMOUNT_MAX_LENGTH: 10, |
There was a problem hiding this comment.
While increasing max allowed number here, it's out of view with some currency symbols.
#81243


Explanation of Change
Fixed Issues
$ #78643
PROPOSAL: #78643 (comment)
Tests
123456789.0,12345678.90,1234567890).Offline tests
Same as test
QA Steps
Same as tests and
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android.Native.mp4
Android: mWeb Chrome
Android.mWeb.Chrome.mp4
iOS: Native
IOS.Native.mp4
iOS: mWeb Safari
IOS.mWeb.Safari.mp4
MacOS: Chrome / Safari
macOS.chrome.mp4