generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Point of Contact] Phone Extension - Limit to 9 digits, 0-9 in string (…
…#1001) closes #997 ## Changes - style(Point of Contact): Phone Extension always gets its own line - content(Point of Contact): Change the helper and error text to match the figma - feat(Point of Contact): Phone Extension validation ## How to test this PR 1. Navigate to Point of Contact 2. Enter valid phone extension - ex. 00757 3. Enter invalid phone extension - ex ukhi778ih89h98h9h9h89h ## Screenshots <img width="534" alt="Screenshot 2024-10-15 at 3 08 40 PM" src="https://github.com/user-attachments/assets/7ed7bae8-9bc0-489f-9e63-a7748e8b9582"> --------- Co-authored-by: Tanner Ricks <182143365+tanner-ricks@users.noreply.github.com>
- Loading branch information
1 parent
fd0cfce
commit c20c5ba
Showing
5 changed files
with
56 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
Ensure only 0-9; strips non-digits | ||
*/ | ||
export function processNumbersOnlyString(input: string): string { | ||
if (input == null || Number.isNaN(input)) return ''; | ||
return input.replaceAll(/\D/g, ''); | ||
} | ||
|
||
export default processNumbersOnlyString; |