stefanfoulis / django-phonenumber-field

A django model and form field for normalised phone numbers using python-phonenumbers
MIT License
1.48k stars 318 forks source link

Document phone number extension handling #583

Closed francoisfreitag closed 9 months ago

francoisfreitag commented 10 months ago

Closes #581

francoisfreitag commented 10 months ago

@stefanfoulis do you remember why E.164 is the default over E.123 (INTERNATIONAL)?

stefanfoulis commented 9 months ago

@stefanfoulis do you remember why E.164 is the default over E.123 (INTERNATIONAL)? I don't know. :-/

francoisfreitag commented 9 months ago

I see. It might be a good idea to transition to the INTERNATIONAL format by default. I’ll start the deprecation in the upcoming weeks, unless someone is concerned with changing the default?

francoisfreitag commented 9 months ago

I started looking at changing the default. I don’t think it’s worth the hassle. I assume most projects don’t use extensions, and the INTERNATIONAL representation is slightly different:

>>> str(phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.INTERNATIONAL))
'+44 20 8366 1177'
>>> str(phonenumbers.format_number(x, phonenumbers.PhoneNumberFormat.E164))
'+442083661177'

The added spaces are sure to break code for someone, who doesn’t care about extensions at all. Unless there’s strong support for changing the default, it’ll stay as E164.