Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Allow explicit prefix in number to override country code #91

@codingisacopingstrategy

Description

Feel free to close when it’s out of scope.
Thanks for your attention!

Expected Behavior

libphonenumber-validate-explicit-foreign-number

In libphonenumber, setting the country code works as a fallback. If I set the country code to BE, it will try to parse numbers without an explicit country prefix as a Belgian number. If, however, I provide a Dutch phone number, as long as I include the Dutch prefix +31, it will validate as well.

Current Behavior

angular-libphonenumber-validate-explicit-foreign-number

In angular-libphonenumber, the country code takes precedence over the prefix. If I set the country code to BE, only Belgian numbers ever validate. If I enter a Dutch phone number +31 6 12345678, it will be marked as invalid.

Possible Solution

It could be that I’ve overlooked a setting somewhere and this behaviour is already possible!

Otherwise, I haven’t yet looked into the internals of libphonenumber and angular-libphonenumber, so I’m not sure how easy it would be to reproduce libphonenumber’s behaviour.

Steps to Reproduce (for bugs)

In https://run.plnkr.co/plunks/k32xZLSRS47w6TW3auAF/ set the country code to BE and try to validate +31 6 12345678.

Context

The context is any application that is used by an organisation or company mainly active in one country, but who will occasionally deal with international users. These users might not have a national phone number, but they will be aware that they need to add their prefix. The national users will be entering their data in various forms, in many cases without the prefix.

Your Environment

I used the online demo available at: https://run.plnkr.co/plunks/k32xZLSRS47w6TW3auAF/

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