-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input phone: do not require space separator between country code and local phone number #2277
Comments
@MarekLacoAXA It seems impossible in general to omit a separator (of any kind, space being just one possible choice) between country-code part and local-phone-number part of a telephone-number string. This is because country codes are not unambiguous world-wide. For example, the country code of Switzerland (+41) is a proper prefix of the country code of Liechtenstein (+417), and it would require knowledge of the entire allowed local-phone-number space of both countries to parse a given separator-free string into its two parts (note that there are many Swiss mobile numbers starting with +417 that are not from Liechtenstein)! |
Here is a lib and its phone numbers namespace knowledge: |
The original ticket description is ambiguous and imprecise. Here is a spec proposal:
|
@MarekLacoAXA Is the aforementioned spec good for you? |
Hi @markus-walther ! Quick&short answers for now: As a consumer of phone-number-input:
Thanks! |
I am not a fond of this. Would prefer to process numbers automatically instead.
"user-entered" -- to you mean here paste into field by end-user, or providing value attribute by consumer sw, or both? If the longest-match strategy is sufficient: I can't judge, but I think it is a good start.
Unsure who cleans the number. Component itself or the consumer?
yes, fail of parsing country is normal.
agree
agree what happens on fail with the previous selected country? will be reset to empty?
seems okay
agree
can't judge Thanks! |
APIs are a contract. PL APIs should be backwards-compatible. Hence a new property, so old behaviour is not gone for users that have built on it already.
User = end user. In ticket #2275 the other case is discussed.
This is entirely the job of the application, in this case you, to research data entry patterns occurring in the wild and possible reactions to this (including the possibility that phone numbers should be processed by backend). Longest-match is a generic strategy that was proposed by you. It does not need excessive new tables that would bloat the component. It would parse +14411235678 to +1441 (Bermuda) 1235678 (phone number) and not e.g. +1 (Canada/USA) ..., because +1441 is the longest prefix that can be matched to a country code.
The component. |
Is this a problem or is this okay? |
Feature request to allow omitting space separator between country code and local phone number.
We need a drop-in replacement for input-text where the input is a whole phone number as-is
We don't want to parse the existing phone numbers to find country codes and artificaly inject spaces after country code in order to be it processable by input-phone component.
Thanks!
The text was updated successfully, but these errors were encountered: