Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@maurer2
Copy link

@maurer2 maurer2 commented May 8, 2024

Hello, following the previous discussion, I added validation for the E.164 format on strings using a modified regex from this article. I removed support for spaces as those don't seem to be permitted. The validation could be further enhanced by prohibiting 0 as the first value since country codes start with 1.

There is an alternative regular expression from the Twilio docs for E.164 numbers. This regular expression permits very short E.164 numbers. It could be used in tandem with the existing string validations like min and max. This would give users the option to adapt the number length further, which seems to be necessary in some instances, according to this stack overflow post.

Cheers

Thank you for your contribution to our project! Before submitting your pull request, please ensure the following:

  • Your code changes are well-documented.
  • You have tested your changes.
  • You have updated any relevant documentation.

@netlify
Copy link

netlify bot commented May 8, 2024

Deploy Preview for guileless-rolypoly-866f8a ready!

Name Link
🔨 Latest commit 55290ee
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/66458d3f4917e80007bb1a13
😎 Deploy Preview https://deploy-preview-3476--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@colinhacks
Copy link
Owner

This seems good to me. Is there a specific reason this is still a draft PR? My plan is to merge this into v4. String validations like uuid, etc are going to be handled quite differently in Zod 4 but I'm happy to merge this as a starting point before I start the refactor.

@maurer2 maurer2 marked this pull request as ready for review May 11, 2024 01:52
@maurer2
Copy link
Author

maurer2 commented May 11, 2024

Hello, apologies for the delay. I first needed to further investigate in order to be able to add the pr description.

Cheers

@colinhacks colinhacks changed the base branch from master to v4 May 14, 2024 20:43
@maurer2
Copy link
Author

maurer2 commented May 15, 2024

Hello, added a section on E.164 to both Readme files.

@MickL
Copy link

MickL commented Dec 22, 2025

@maurer2 Really nice work!!! I added a new issue tho because E.164 should not allow a zero after the country code, e.g. +49030 should be invalid but currently is valid.

Issue: #5563

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.

3 participants