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

Fix: do not insert an extra space in formatted numbers #1

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

ledbettj
Copy link

@ledbettj ledbettj commented Jan 18, 2018

When we generate the national format for a given phone number, the output format is specified by the global_phone.json database.

For example, New Zealand is $1-$2 $3 where:

  • $1 is the national prefix,
  • $2 is the first group of digits
  • $3 is the last group of digits.

However, when the national prefix is added to the number, we are erroneously inserting an extra space between the NP and the first group. For NZ, this results in 09 -123 1234, and for other countries it results in a double space: 02 1234 1234.
Since the spacing is included in the format specified by the DB, we should not need to add any additional spacing here.

When we generate the national format for a given phone number,
the output format is specified by the global_phone.json database.
For example, New Zealand is '$1-$2 $3' where $1 is the national prefix,
$2 is the first group of digits, and $3 is the last group of digits.
However, when the national prefix is added to the number, we are
erroneously inserting an extra space between the NP and the first group.
For NZ, this results in '09 -123 1234', and for other countries it results
in a double space: '02  1234 1234'.
Since the spacing is included in the format specified by the DB,
we should not need to add any additional spacing here.
@ledbettj
Copy link
Author

ledbettj commented Jan 18, 2018

Here are some pre-fix examples:

029234  2343
(303) 564-4222
(03)  2234 2343
09 -234 2343

Here are some post-fix examples:

029234 2343
(303) 564-4222
(03) 2234 2343
09-234 2343

@jkronz jkronz merged commit c25471b into master Jan 18, 2018
@jkronz jkronz deleted the jl/remove-double-spaces branch January 18, 2018 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants