Skip to content

Conversation

@rimas-kudelis
Copy link
Contributor

This fixes #820 in a more complete way.

- Frontend: validate via libphonenumber-js if object found
- Backend: optionally validate using libphonenumber-for-php,  if appropriate setting is toggled on
@alextselegidis
Copy link
Owner

Great thanks, this looks good!

Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!

@rimas-kudelis
Copy link
Contributor Author

rimas-kudelis commented Mar 3, 2025

Potential caveats/improvement options here:

  • I only include libphonenumber-js in the customer "create appointment" UI, so the thorough front-end check will not happen in other cases (it will fall back to your current logic).
  • Same applies to backend validation: I only perform it when a customer is creating an appointment, not in any other case.
  • Also, the setting only affects backend.
  • Unless you specify a specific country to use by default, both frontend and backend validations are country-agnostic, meaning, they will require a phone in full international +123456789 format. It's possible to pass a country code to the validation, in which case numbers for that country will be accepted in locally standardised prefix (e.g. 0123456789).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants