Now that area codes are required for US phone numbers, would it be possible to have a feature that allows you to use a simple dash instead of parentheses for the area code? For example, instead of formatting phone numbers (555)555-5555, it should be 555-555-5555. Thanks.

Members fund testing for the Drupal project. Drupal Association Learn more


carrierawks’s picture

I can't even get it to do the ( ) part or dashes.

jstuckle’s picture

Area codes are not required in all cases. In some places (like where I live), you must dial 10 digits. But other parts of the country only require 7 digits. People in those areas are not used to typing in the area code for a local site.

However, another standard has emerged over the years - the use of a period ('.') instead of a hyphen or parens, i.e. 111.111.1111

thekevinday’s picture

And where I live, the following cases are accepted:
- 4 digits
- 7 digits
- 10 digits
- 11 digits (technically, but I have never ever seen anyone put 1 in front of a number except for 1-800/business numbers)

System: US/Canada.

I am going to look into creating a patch for these cases.

thekevinday’s picture

While trying to solve this problem, I just ran into more and more issues.
So, the solution I came up with is...rather large.
Because of this, I am not sure it will be accepted.

Still here I am supplying the patches here in case you want to try it.
(I had to fix webform_phone as well, so patch also attached.)

What I did was add a new option that allows for setting the minimum number of digits to be allowed for US/CA phone numbers.
The following minimums were defined: 4, 7, 10, and 11.

The initial issue with () can be turned off by unchecking "Use parentheses around area code".