Git Product home page Git Product logo

Comments (3)

albeebe avatar albeebe commented on June 3, 2024

You bring up a great point. libphonenumber has another method isValidNumberForRegion which does take into account the selected country. https://code.google.com/p/libphonenumber/source/browse/trunk/javascript/i18n/phonenumbers/phonenumberutil.js#2672

I will add this new method later on today. Thank you for the kind words, it motivates me!

from phoneformat.js.

eirc avatar eirc commented on June 3, 2024

Indeed that seems more logical

from phoneformat.js.

AlfredJKwack avatar AlfredJKwack commented on June 3, 2024

There's another issue as well with regards to the "International" display.
Test case: 149133000 with country France.
When trying this on the libphonenumber demo site it returns the correct results.

_Parsing Result:_
{"country_code":33,"national_number":149133000,"raw_input":"149133000","country_code_source":20,"preferred_domestic_carrier_code":""}

_Validation Results:_
Result from isPossibleNumber(): true
Result from isValidNumber(): true
Result from isValidNumberForRegion(): true
Phone Number region: FR
Result from getNumberType(): FIXED_LINE

*_Formatting Results:_*
E164 format: +33149133000
Original format: 1 49 13 30 00
National format: 01 49 13 30 00
International format: +33 1 49 13 30 00
Out-of-country format from US: 011 33 1 49 13 30 00
Out-of-country format from Switzerland: 00 33 1 49 13 30 00

from phoneformat.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.