fix: preserve Brazilian area code 83 (Paraíba state) - Issue #179#180
Open
MarcosPereira1 wants to merge 2 commits intocaseyryan:masterfrom
Open
fix: preserve Brazilian area code 83 (Paraíba state) - Issue #179#180MarcosPereira1 wants to merge 2 commits intocaseyryan:masterfrom
MarcosPereira1 wants to merge 2 commits intocaseyryan:masterfrom
Conversation
Fixes issue where Brazilian numbers starting with 83 were incorrectly converted to Russian format. Adds tests to ensure proper formatting for both Brazilian and Russian phone numbers.
7f80d71 to
12c7369
Compare
Owner
|
Hi, sorry, but this solution again conflicts with the Russian city phone numbers which often start with +73 like Novosibirsk numbers start +7 (383) but people often type 8 (383) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem Description
Fixes #179 - The
PhoneInputFormatterwas incorrectly converting Brazilian area code 83 (Paraíba state) to 73 (Bahia state) due to a conflict in the Russian phone number correction logic.Root Cause
The Russian phone correction logic was designed to handle both
89and83patterns, but the83pattern conflicts with a valid Brazilian area code:Solution
Refined the Russian correction to focus on the
89pattern, which is the most common case, while avoiding the conflict with Brazilian numbers:Why This Solution Works
(83) 98765-432189patterns still convert to+7 (9xx) xxx-xx-xxTest Results
83987654321→(83) 98765-432189123456789→+7 (912) 345-67-89Files Changed
lib/formatters/phone_input_formatter.dart- Refined Russian correction logictest/flutter_multi_formatter_test.dart- Added Brazilian area code 83 testsImpact
This fix resolves the formatting issue for Brazilian users in Paraíba state while maintaining compatibility with Russian phone number corrections.