Format output of serialized value
See original GitHub issueI’m using the Input
component (no country select) for only US numbers with country="US"
set. When I input the number, its formatted correctly (example: 5551234567
formats to (555) 123-4567
visually in the input) but when the data is submitted and serialized as part of a form, the number is coming through as +15551234567
. I’d like to only get 5551234567
without the +1
at the beginning. Is there a way to format the serialized output when submitting the form without having to manually grab the data of the phone input, remove the +1
doing something like phone.replace('+1', '')
, and then adding that back to the submit data? I’d love to make this part of the component itself not have to manually alter form data everywhere that we use a PhoneInput
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
I don’t care about your custom hacky case btw
Then create a custom component wrapping this library’s component. Do I really have to explain such basic stuff to a “React developer”?