catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.76k stars 218 forks source link

Missing dashes when using International format #457

Closed sylvhama closed 6 months ago

sylvhama commented 6 months ago

This issue is a repost of https://github.com/catamphetamine/libphonenumber-js/issues/163 while respecting the suggested bug formatting.

On this libphonenumber-js demo page you can notice that the Canadian phone number 5144311489 is formatted as +1 514 431 1489 when picking International format.

On this Google's demo page you can see that the same phone number will be formatted as +1 514-431-1489 when looking at the International format row.

I would expect the same format as Google or maybe an option to use dashes instead of spaces.

sylvhama commented 6 months ago

It seems to only be an issue for US and Canadian phone numbers (+1 region).

EDIT: I made some researches and others countries seem to use dashes too for their international format such as Japan and 88 more if we trust ChatGPT.

catamphetamine commented 6 months ago

Hello. See the very beginning of the readme where it lists the differences. This is one of them. Not a bug.

On Thu, 15 Feb 2024 at 00:06, Sylvain Hamann @.***> wrote:

It seems to only be an issue for US and Canadian phone numbers (+1 region).

— Reply to this email directly, view it on GitHub https://github.com/catamphetamine/libphonenumber-js/issues/457#issuecomment-1944590102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADUP36FWRYGZPZLFTXL55TYTUROJAVCNFSM6AAAAABDITPV2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBUGU4TAMJQGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

catamphetamine commented 6 months ago

-

Doesn't use hyphens or brackets when formatting international phone numbers, only whitespace (seems more logical this way).

On Thu, 15 Feb 2024 at 05:07, Николай Кучумов @.***> wrote:

Hello. See the very beginning of the readme where it lists the differences. This is one of them. Not a bug.

On Thu, 15 Feb 2024 at 00:06, Sylvain Hamann @.***> wrote:

It seems to only be an issue for US and Canadian phone numbers (+1 region).

— Reply to this email directly, view it on GitHub https://github.com/catamphetamine/libphonenumber-js/issues/457#issuecomment-1944590102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADUP36FWRYGZPZLFTXL55TYTUROJAVCNFSM6AAAAABDITPV2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBUGU4TAMJQGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>