Aziz Bhavnagarwala
Aziz Bhavnagarwala

Reputation: 1

react-phone-input-2 country.format not working

I am using react-phone-input-2 in my react project and in onChange function the country.format function is giving wrong format for most countries.

I want to validate the number of digits countrywise. So, in onChange function it is giving phone and country parameters. So, the country parameter is giving this much things.

{
    "name": "Kuwait",
    "regions": [
        "middle-east"
    ],
    "iso2": "kw",
    "countryCode": "965",
    "dialCode": "965",
    "format": "+... ... ... ... ... ..",
    "priority": 0
}

Here, we can see that for country Kuwait it is giving total 17 dots. If we remove 3 of dial code then also 14 remains and that's wrong. Cause Kuwait only has 8 digit phone number.

This is just an example. It is happening for many countries. Please, someone help me how can I verify number of digits countrywise.

Upvotes: 0

Views: 176

Answers (0)

Related Questions