Skip to content
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

Update phone number length for Congo-Brazzaville #404

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Batutankuma
Copy link

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

use intl_mobile_field package

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.

2 participants