User Tools

Site Tools


javascript:validate-phonenumbers

Validate Phonenumbers

https://www.npmjs.com/package/libphonenumber-js

Demo:
https://catamphetamine.gitlab.io/libphonenumber-js/

Gitlab:
https://gitlab.com/catamphetamine/libphonenumber-js

Example:

<html>
    <head>
        <title>libphonenumber-js</title>
        <meta charset="UTF-8">

        <!--        <script src="https://unpkg.com/libphonenumber-js@[version]/bundle/libphonenumber-[type].js"></script> -->
        <script src="https://unpkg.com/libphonenumber-js@1.x/bundle/libphonenumber-min.js"></script>

    </head>
    <body>
        <script>
            checknumber = libphonenumber.parsePhoneNumber('00  44 1234 567 890','GB')
            alert(checknumber.country+" "+checknumber.formatInternational() + " Valid:"+checknumber.isValid() + " Possible:"+checknumber.isPossible())
        </script>
    </body>
</html>
javascript/validate-phonenumbers.txt · Last modified: 2023/05/29 11:55 by 127.0.0.1