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
158 stars 65 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 6 months ago

GabrielaCloudNine commented 8 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 6 months ago

Hello !

Not sure what you mean.. Please provide a codesandbox