Skip to content

Add support for (XXX) XXX-XXXX format and ability to remove country code#61

Open
wswoodruff wants to merge 12 commits intoPolymerElements:masterfrom
wswoodruff:master
Open

Add support for (XXX) XXX-XXXX format and ability to remove country code#61
wswoodruff wants to merge 12 commits intoPolymerElements:masterfrom
wswoodruff:master

Conversation

@wswoodruff
Copy link
Copy Markdown

No description provided.

@wswoodruff wswoodruff changed the title Add support for (XXX) XXX-XXXX format and able to remove country code Add support for (XXX) XXX-XXXX format and ability to remove country code Mar 18, 2016
@yordis
Copy link
Copy Markdown

yordis commented Jun 1, 2016

@WilliamSWoodruff Can you check the Travis please. Some tests are failing.

@notwaldorf hey can we have something like this as soon as possible?

@wswoodruff
Copy link
Copy Markdown
Author

@yordis Cool! I'll take a look at those failing tests

@yordis
Copy link
Copy Markdown

yordis commented Jun 1, 2016

@WilliamSWoodruff still failing in the test

@wswoodruff
Copy link
Copy Markdown
Author

wswoodruff commented Jun 1, 2016

@yordis Ah, those tests were passing before I changed the default format to (xxx) xxx-xxxx. I'll fix them if you think it should be the default. Otherwise, should I put the default back to xxx-xxx-xxxx ?

@yordis
Copy link
Copy Markdown

yordis commented Jun 1, 2016

@WilliamSWoodruff put the default format back and if you can, please create a test that get your changes with the different format so we validates that works.

@wswoodruff
Copy link
Copy Markdown
Author

wswoodruff commented Jun 2, 2016

@yordis @notwaldorf All tests are passing. Is this PR ready to go?

Comment thread gold-phone-input.html Outdated
<span class="country-code">+[[countryCode]]</span>

<template is="dom-if" if="{{!noCountryCode}}">
<span class="country-code">+[[countryCode]]</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using hidden is cheaper in this case than a dom-if

@notwaldorf
Copy link
Copy Markdown
Contributor

My biggest comment is that I am not convinced the bracketing is required. XXX-XXX-XXXX (instead of (XXX) XXX-XXXX could still be used using the existing element, and wouldn't add all the duplicated left parenthesis/right parenthesis code.

@wswoodruff
Copy link
Copy Markdown
Author

@notwaldorf These changes do affect the complexity of caret handling. The utility of the PR appeals mostly to US phone numbers, which is the default assumption. My argument would be a less-than-trivial performance hit to improve user experience. Parentheses and spaces act exactly the same if entered manually if they match the the phone-number-pattern

@yordis
Copy link
Copy Markdown

yordis commented Jun 2, 2016

@notwaldorf for US is actually common use parenthesis so from user experience this is something that add value.

And I really need something like remove the Country Code, I don't want to show that in some interfaces.

@yordis
Copy link
Copy Markdown

yordis commented Jun 2, 2016

@WilliamSWoodruff check the error please

@yordis
Copy link
Copy Markdown

yordis commented Jun 3, 2016

@notwaldorf what do you think?

Comment thread gold-phone-input.html
value = value.replace(/\)/g, '');
value = value.replace(/\s/g, '');

oldValue = oldValue.replace(/-/g, '');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do this twice, for both value and oldValue?

Comment thread gold-phone-input.html
// when counting the position of new dashes in the pattern.
if (shouldFormat && i == (currentDashIndex - totalDashesAdded)) {

if (i == leftParenIndex) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be abstracted in a function?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be abstracted in a function?

@notwaldorf
Copy link
Copy Markdown
Contributor

@yordis I think this PR needs a lot of work. At the moment it's basically copy pasting the same code 3 times, which is very hard to read and maintain, and I'm a bit uncomfortable merging it as it is :(

@wswoodruff
Copy link
Copy Markdown
Author

@notwaldorf I'd be happy to make those changes!

@drwaky
Copy link
Copy Markdown

drwaky commented May 17, 2017

Hey! Hi there!

What happens finally with this feature @notwaldorf @yordis ??

It would be nice to me have it, because I need to support (XXX) XXX-XXXX format.

Thanks!

@yordis
Copy link
Copy Markdown

yordis commented May 17, 2017

@drwaky no clue about it I tried to help on the process but @notwaldorf is the person that could help on this

@masonlouchart
Copy link
Copy Markdown
Contributor

masonlouchart commented Jul 17, 2018

This PR is fairly old and there hasn't been much activity on it.

@wswoodruff
Copy link
Copy Markdown
Author

@masonlouchart Unfortunately I don't work with Polymer anymore and I won't be able to finish this. You're welcome to pickup where I left off though

@masonlouchart
Copy link
Copy Markdown
Contributor

This source code is old more than 2 years, there is conflict and a new version is released. Unfortunately it'd be wiser to drop it.

@wswoodruff
Copy link
Copy Markdown
Author

Yes I think Polymer has bumped 3 major versions since this -- was written while working on v1

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants