Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow phone number dashes #495

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

selenaliu1
Copy link
Contributor

Summary

  • edited Rider modal and Employee modal to allow dashes in the phone number

Test Plan

Valid inputs:
Screenshot 2024-03-02 at 11 49 40 AM
Screenshot 2024-03-02 at 11 59 48 AM
Invalid inputs (too long):
Screenshot 2024-03-02 at 12 00 05 PM

Notes

  • Accepts 10-12 characters, but only takes the first 10 numbers

Breaking Changes

@selenaliu1 selenaliu1 requested a review from a team as a code owner March 2, 2024 17:04
@dti-github-bot
Copy link
Member

dti-github-bot commented Mar 2, 2024

[diff-counting] Significant lines: 11.

Copy link
Contributor

@raissaji raissaji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A suggestion is to explicitly define where the dashes should be, so that a phone number like 40-98204-652 will be flagged as invalid.

@andrewschoi
Copy link
Contributor

maxLength and minLength are not needed. Change pattern to be a regular expression for a phone number.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions

            ref={register({
              required: true,
              pattern: /^[0-9-]{10,}$/,
              maxLength: 12,
              minLength: 10,
            })}

Copy link
Collaborator

@Atikpui007 Atikpui007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define a validity check to ensure that dashes cannot just be placed anywhere.

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.

5 participants