Leading 0 in number form type with region code context #145
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
If the widget PhoneNumberType::WIDGET_COUNTRY_CHOICE is used, the number in the number form type contains leading zeros. In the context of the select form type of the region code this is unexpected: +49 02408 95660 instead of +49 2408 95660
Currently the PhoneNumberToArrayTransformer uses
'number' => $util->format($phoneNumber, PhoneNumberFormat::NATIONAL),
Perhaps the better way is to strip the leading zeros:
'number' => $this->getNationalNumberForRegionCodeContext($util->format($phoneNumber, PhoneNumberFormat::NATIONAL), $phoneNumber),
Other numbers perhabs for unit tests:
+43533765123
+41625571123
+390669812123 (hasItalianLeadingZero)
+390863530123
+39393508123
The text was updated successfully, but these errors were encountered: