Skip to content

Checking behaviour of useNationalFormatForDefaultCountryValue=true #452

Open
@4jandals

Description

@4jandals

The behaviour of useNationalFormatForDefaultCountryValue=true as described in the docs suggests that when a number matches the defaultCountry the number will be formatted as a national number. This doesn't seem to be happening for me.

i.e. I have this basic definition

<PhoneInput 
  defaultCountry="GB"
  value={field.value}
  onChange={field.onChange}
/>

And then I enter a number as 01234 100100 which is stored in the database correctly as +441234100100, when the form is re-rendered, the number becomes +44 1234 100100. Where as I'm expecting it to be 01234 100100 since it's a GB number which matches the defaultCountry.

Or am I misunderstanding the behaviour here? Basically if a user enters a number for their country, I'd like to show the national format. Whereas if a user enters a number for a different country, I'd like to show the international format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions