viclafouch / mui-tel-input

📌 A phone number input designed for MUI (Material ui) V6 built with libphonenumber-js
https://viclafouch.github.io/mui-tel-input
MIT License
171 stars 67 forks source link

How can I validate a phone number when prefix is selected but number not, but the field is not required? #113

Closed GabrielaCloudNine closed 8 months ago

GabrielaCloudNine commented 10 months ago

Now we apply the following check to omit the prefix, but is there a smarter way to valid it?

if (val?.length >= 5) {
      return matchIsValidTel(val);
}
viclafouch commented 8 months ago

Hello !

Not sure what you mean.. Please provide a codesandbox