Skip to content

Update phone number length for Congo-Brazzaville#404

Open
Batutankuma wants to merge 6 commits intovanshg395:masterfrom
Batutankuma:master
Open

Update phone number length for Congo-Brazzaville#404
Batutankuma wants to merge 6 commits intovanshg395:masterfrom
Batutankuma:master

Conversation

@Batutankuma
Copy link
Copy Markdown

I encountered an issue when trying to register a Congo-Brazzaville phone number in the input number field. The length after the country code was set to 7 characters, but phone numbers in Congo-Brazzaville should have 9 characters after the country code, similar to the Democratic Republic of Congo (DRC), which is my country of origin.

Example of the issue:

Incorrect: +242 1234567
Correct: +242 123456789
To fix this, I updated the length in the country.dart file for Congo-Brazzaville:

Country( name: "Congo", nameTranslations: { "sk": "Konžská republika", "se": "Kongo-Brazzaville", "pl": "Kongo", "no": "Kongo-Brazzaville", "ja": "コンゴ共和国(ブラザビル)", "it": "Congo-Brazzaville", "zh": "刚果(布)", "nl": "Congo-Brazzaville", "de": "Kongo-Brazzaville", "fr": "Congo-Brazzaville", "es": "Congo", "en": "Congo - Brazzaville", "pt_BR": "República do Congo", "sr-Cyrl": "Република Конго", "sr-Latn": "Republika Kongo", "zh_TW": "剛果共和國(布拉柴維爾)", "tr": "Kongo Cumhuriyeti", "ro": "Republica Congo", "ar": "جمهورية الكونغو", "fa": "جمهوری کنگو", "yue": "剛果(共和國)" }, flag: "🇨🇬", code: "CG", dialCode: "242", minLength: 9, // updated maxLength: 9, // updated ),
I also wrote a test to confirm the changes work correctly:
test('create CG PhoneNumber from +242057009244', () { PhoneNumber phoneNumber = PhoneNumber.fromCompleteNumber(completeNumber: "+242057009244"); expect(phoneNumber.countryISOCode, "CG"); expect(phoneNumber.countryCode, "242"); expect(phoneNumber.number, "057009244"); expect(phoneNumber.isValidNumber(), true); });

@MdAshrafUllah
Copy link
Copy Markdown

use intl_mobile_field package

@neoacevedo
Copy link
Copy Markdown

neoacevedo commented Dec 12, 2024

Check the README. This package is not longer maintained so your pull request won't be reviewed or merged anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants