catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.8k stars 216 forks source link

Get the template/pattern for the phonenumber #408

Closed phun-ky closed 3 years ago

phun-ky commented 3 years ago

Hi! I need to get the pattern/template for the current country selected. as in:


import {getTemplate} from  'libphonenumber-js';
const _country = 'NO';
const _placeholder = getTemplate(_country);
input.placeholder = _placeholder;

Will result in input placeholder: 000 00 000 or 123 45 678

Or a regex so we can use in custom validation.

catamphetamine commented 3 years ago

There's no single pattern for a country

phun-ky commented 3 years ago

Ehm, how is it validated then? Do not close before issue is resolved please. You already have the template, why can't ot be assigned oer country? Sendt fra min Galaxy -------- Opprinnelig melding --------Fra: Nikolay @.> Dato: 09.07.2021 13:58 (GMT+01:00) Til: catamphetamine/libphonenumber-js @.> Ko: Alexander Vassbotn Røyne-Helgesen @.>, Author @.> Emne: Re: [catamphetamine/libphonenumber-js] Get the template/pattern for the phonenumber (#408) There's no single pattern for a country

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.