3 ms·
Cute, but it looks like it's trying too hard to be clever. Are you expecting websites to show a giant pop-up menu of 2-letter country codes to users? Or are y
by ken 8y ago
Cute, but it looks like it's trying too hard to be clever.
Are you expecting websites to show a giant pop-up menu of 2-letter country codes to users? Or are you expecting websites to hardcode one country, and reject phone numbers which don't match that pattern? And what about extensions?
For dates, most browsers support form type="date" and the like. That's going to be better than whatever you use here.
For credit cards, it's fine, because 16 decimal digits is a universal standard. For anything else, it's going to cause as many problems as it solves.
- leesalminen 8y agoAmerican Express cards are 15 digits.
- ken 8y agoHa! Shows what I know. Exceptions abound.
- jarekkruk 8y agoFor phone numbers if you accept numbers without country code then you need to know it. This library correctly handles numbers with country code without specifying the country in other way.