question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Format output of serialized value

See original GitHub issue

I’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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
catamphetaminecommented, Jan 26, 2022

I don’t care about your custom hacky case btw

1reaction
catamphetaminecommented, Jan 26, 2022

but its an extra step we have to do wherever we have a form that uses a phone input

Then create a custom component wrapping this library’s component. Do I really have to explain such basic stuff to a “React developer”?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serialization Formats - ksqlDB Documentation
DATE typed data is serialized as an int value indicating the number of days since the Unix epoch. BYTES typed data is serialized...
Read more >
Specify output format of DataContractJsonSerializer?
For the project at hand I have to use DataContractJsonSerializer for serialization and have to generate a specific output based on the member's ......
Read more >
A Comparison Of Serialization Formats - mbedded.ninja
A review of popular serialization formats (CSV, JSON, YAML, e.t.c), including speed and memory comparisons.
Read more >
What is serialization and how does it work? - Hazelcast
Serialization is the process of converting a data object into a series of bytes that saves the state of the object in an...
Read more >
Serialization - Wikipedia
In computing, serialization (or serialisation) is the process of translating a data structure or object state into a format that can be stored...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found