Skip to content
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

getAsYouTypeFormatter missing #87

Closed
vladrusu opened this issue Oct 24, 2015 · 10 comments
Closed

getAsYouTypeFormatter missing #87

vladrusu opened this issue Oct 24, 2015 · 10 comments
Assignees

Comments

@vladrusu
Copy link

Hello !
I saw that the getAsYouTypeFormatter functionality is missing from your package. :(
It is present it the official Google library (v7.1.0).

Can you please implement it?

I am refering to this:
Formatting Phone Numbers 'as you type'

PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("US");
System.out.println(formatter.inputDigit('6')); // Outputs "6"
... // Input more digits
System.out.println(formatter.inputDigit('3')); // Now outputs "650 253"

@giggsey
Copy link
Owner

giggsey commented Oct 24, 2015

Hi,

What's the point of an As You Type Formatter for PHP?

If you are doing it via a web form, then you would need to send an AJAX
request for every character typed (in which case you might as well use the
JavaScript version).
On 24 Oct 2015 22:58, "Vlad Rusu" notifications@github.com wrote:

Hello !
I saw that the getAsYouTypeFormatter functionality is missing from your
package. :(
It is present it the official Google library (v7.1.0).

Can you please implement it?

I am refering to this:
Formatting Phone Numbers 'as you type'

PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter("US");
System.out.println(formatter.inputDigit('6')); // Outputs "6"
... // Input more digits
System.out.println(formatter.inputDigit('3')); // Now outputs "650 253"


Reply to this email directly or view it on GitHub
#87.

@vladrusu
Copy link
Author

Hi!
For a project I currently work on, I would like to parse/format a partial introduced number programatically (in server code, not AJAX).
For example:
Partial number: 1555245
Country Code: US
Expected result: 1 555-245

Using $phoneUtil->format on "1555245" gives me these results:
E164 format invalid
Original format 155-5245
National format 155-5245

Currently, I am unaware of a way to get "1 555-245" from "1555245". If you know one, please let me know.

@giggsey
Copy link
Owner

giggsey commented Oct 25, 2015

Sorry, but I still don't see the use case. I can't think of a reason you would need to format a partially input number, unless you are expecting further input.

@giggsey
Copy link
Owner

giggsey commented Nov 12, 2015

Closing issue.

I'll be happy to re-open it if you can convince me of a use case.

@giggsey giggsey closed this as completed Nov 12, 2015
@AlexanderMatveev
Copy link

AlexanderMatveev commented May 26, 2016

@giggsey one case is getting all possible prefixes for country, I guess.

@giggsey
Copy link
Owner

giggsey commented May 26, 2016

The AsYouTypeFormatter wouldn't help there though, because it wouldn't format the number until you hit a valid number.

@AlexanderMatveev
Copy link

What's the way to get this?

dominican republic country code 1 809 country code do 2016-05-26 16-46-19

@giggsey
Copy link
Owner

giggsey commented May 26, 2016

I don't think that's actually possible.

You can get the patterns for each number type, but you'll have to work out the prefix by yourself.

@giggsey giggsey self-assigned this Mar 27, 2017
@giggsey
Copy link
Owner

giggsey commented Mar 27, 2017

Reopening, as I'm going to implement this.

@giggsey giggsey reopened this Mar 27, 2017
@AlexanderMatveev
Copy link

@giggsey that's good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants