Text-mask: Requested masks

Created on 3 Sep 2016  路  7Comments  路  Source: text-mask/text-mask

These are some use-cases that I think Text Mask should provide addons for:

  • [ ] Brazilian phone number (#174)
  • [x] Auto corrected DD/MM/YYYY (#185)
  • [ ] General mask for variable text (Twitter IDs, passwords?, etc)
addons

Most helpful comment

@msafi sure. Below is example:
USA phone: +1 (555) 495-3947 - country code 1 symbol
Japan phone: +81 (555) 495-3947 - country code 2 symbols
Ukraine phone: +380 (555) 495-3947 - country code 3 symbols

I requiring to make universal mask where all these numbers will be valid.

All 7 comments

I also requesting country code(1-3 symbols) in phone mask. Phone mask is one of main features but current syntax to realize this is terrible.

@vadimzham I don't quite understand what you're requesting? Could you explain please?

@msafi sure. Below is example:
USA phone: +1 (555) 495-3947 - country code 1 symbol
Japan phone: +81 (555) 495-3947 - country code 2 symbols
Ukraine phone: +380 (555) 495-3947 - country code 3 symbols

I requiring to make universal mask where all these numbers will be valid.

@vadimzham just note that many countries don't have area codes, so I'm not sure if this is easy to write. A danish phone number looks like this:

+45 23 45 67 89

@mzedeler international phone number format is country-code + 10-digits.
Here are only few countries that doesn't match that format.

In regards to a mask per country for phone numbers. It would be possible to dynamically output masks for a selected country by using the data provided by Google libphonenumber: https://github.com/googlei18n/libphonenumber
With an example of the library in action: https://rawgit.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/demo-compiled.html

Here's an example of a library that already uses that data to dynamically change the placeholder. We could go one step further and create the mask per country as well: https://github.com/jackocnr/intl-tel-input

I followed this example and works great.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

badre429 picture badre429  路  3Comments

caub picture caub  路  4Comments

GeometricProgress picture GeometricProgress  路  4Comments

skube picture skube  路  3Comments

cargonsan picture cargonsan  路  4Comments