Re:Cleave.js – Format input text content when you are typing
by leesalminen on Saturday February 23, 2019 @11:52AM
(#19234126)
American Express cards are 15 digits.
Re:Cleave.js – Format input text content when you are typing
by ken on Saturday February 23, 2019 @12:27PM
(#19234319)
Ha! Shows what I know. Exceptions abound.
Re:Cleave.js – Format input text content when you are typing
by jarekkruk on Saturday February 23, 2019 @01:39PM
(#19234793)
For 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.
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.