-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix/78095: Comma split on locale languages #78246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dangrous
merged 5 commits into
Expensify:main
from
btkcodedev:btkcodedev/78095CommaSpanish
Jan 8, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5e0e9e5
fix: comma split on locale languages
btkcodedev b82d2f1
update: test cases with both comma and dot
btkcodedev 080caf2
use existing function for replacement
btkcodedev 4ee02d3
fix: alphabetize imports
btkcodedev 3b92690
Merge remote-tracking branch 'origin/main' into btkcodedev/78095Comma…
btkcodedev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the only test cases I'm unsure about - should these be accepted (assuming
allowExceedingHundred)? Both would be valid percentages, since the first punctuation is being used as a hundreds separator instead of a decimal. What would the first one1,234.56return BEFORE we made the changes in this branch?I realize we may need to do some combo of
replaceCommasWithPeriodandstripCommasFromAmount- maybe we swap all periods with commas or something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifications:
Before this branch, the regex only allowed one period not comma(which is the whole issue), so 1,234.56 would have been obviously rejected.
Currently new regex - [.,]? optionally ONE comma or period followed by \d? optionally ONE more digit
Regarding the concern about users entering commas as thousands separators: the input allows only a single decimal digit. This greatly limits the possibility of mixed notation or user confusion.
a) Percentages 0-100 should never need thousands separators as in default
b) IF allowExceedingHundred is passed, this is regex:
/^\d*[.,]?\d?$/u- very permissive, allows any number with optional one decimalThe validation correctly supports either a comma or a period as the decimal separator, but not thousands separators or mixed notation, which is appropriate for percentages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @dangrous 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm okay - @heyjennahay from a product perspective, what do you think here? Is it okay to disallow someone putting
1,234.56into the percentage (while allowing 1234.56)? I think it's pretty much an edge case, but since we're in there changing the logic, figured I'd check. Seems like it would make it a little more complicatedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow reply. I think this is fine. As you say, it is an edge case and not really worth putting a "complete" solution which handles all cases.