Open dieu-vu opened 1 month ago
Hi. It looks like the behavior is correct: you've chosen a country and it has formatted the phone number in local format, where the leading 0
is valid.
Thanks @catamphetamine!
The correct format should be without the leading 0
as there is country code in the value already.
"+358500000003" => should it be "500000003" only in the input field?
So is this intentionally formated with leading 0
there. Could we have a work around to remove that? As it looks a bit weird with the country code then still having the leading 0
, even though the value is still received correctly through the form. I tried many ways but couldn't do that yet.
Thank you!
No, the format is fine and is as expected. There’s no country code. The number is not international.
On Thu, 19 Sep 2024 at 15:13, Dieu Vu @.***> wrote:
Thanks @catamphetamine https://github.com/catamphetamine! The correct format should be without the leading 0 as there is country code in the value already. "+358500000003" => should it be "500000003" only in the input field? So is this intentionally formated with leading 0 there. Could we have a work around to remove that, as it looks a bit weird with the country code then still having the leading 0? I tried many ways but couldn't do that yet. Thank you!
— Reply to this email directly, view it on GitHub https://github.com/catamphetamine/react-phone-number-input/issues/447#issuecomment-2360825263, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADUP3YV43BI2YNSOWKPDJTZXK5YFAVCNFSM6AAAAABOPYQFOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRQHAZDKMRWGM . You are receiving this because you were mentioned.Message ID: @.***>
@catamphetamine Is there no other way to remove it for consistency reasons? as for example the user inputted "+201100458945" and the value is cached, when it's prefilled it looks like "+2001100458945" and I want to keep it as it was inputted.
Hello, I found that the phone number is having leading zero in the prefilled-value, even though it has the country code correctly. For example, we set the value
value={ contactDetails?.mobile ?? ''" )}
on the inpur field to prefill the value when open up the input form. WithcontactDetails.mobile = "+358500000003"
from our API, we got the prefilled value with extra leading zero. Could you help check this bug? Thank you!