Open ccg-tim opened 3 years ago
Note, this has already been reported on issue #297, however, it is important to note that the number format that was shown was for Premium rate SMS - but this issue is not a premium rate SMS number. As shown in the screenshot, it is a SHARED_COST number, similar to 1300-numbers.
Smartnumbers® are 13, 1300 or 1800 telephone numbers. Smartnumbers® include phonewords like 13 CATS (13 2287) and distinctive patterned numbers such as 1300 222 222.
https://www.thenumberingsystem.com.au/
Smartnumbers are catchy numbers. They might:
- be in a pattern, such as 1300 456 789
- have double digits, such as 1300 222 222
https://www.acma.gov.au/buy-custom-number
<!-- Local-rate (SmartNumbers) are put here because they are a reverse-charge network,
although they charge a small local call connect fee (around 25c). These start with 13
or 1300. -->
<sharedCost>
<possibleLengths national="6,8,10"/>
<exampleNumber>1300123456</exampleNumber>
<nationalNumberPattern>
13(?:
00\d{3}|
45[0-4]
)\d{3}|
13\d{4}
</nationalNumberPattern>
</sharedCost>
<!-- 6-digit variable cost fixed line (toll free, premium rate, shared cost) -->
<numberFormat pattern="(\d{2})(\d{2})(\d{2})">
<leadingDigits>13</leadingDigits>
<format>$1 $2 $3</format>
<intlFormat>NA</intlFormat>
</numberFormat>
Hi. Thanks for the detailed report 👍. It does help having such details when issues are reported.
I have changed the README description previously to remove the seemingly too complex note about the library not formatting phone numbers with area code omitted: https://raw.githubusercontent.com/catamphetamine/libphonenumber-js/master/README.md
456-789
instead of (123) 456-789
. Google's libphonenumber
supports formatting such numbers (with "area code" omitted) because it is used for dialing on the Android phone operating system. Because libphonenumber-js
isn't a phone operating system and it's not used for dialing, it doesn't format such "shortened" phone numbers.Looks like I should re-add it because you're the first one who has reported something like this, and it happened after I've removed that note.
Don't close this issue though because it will be something that others could see. I'll update the README on GitLab and on GitHub. The NPM readme will be updated on next package release.
No worries, happy to help :)
This is not a number without an area code. Similar to the 1300 number (https://libphonenumber.appspot.com/phonenumberparser?number=1300555444&country=AU) which does get formatted correctly, the 13 number works in all areas of Australia.
Here is an Aussie ad for good measure :) https://www.youtube.com/watch?v=Y0HchzE-7rM
Here is an Aussie ad for good measure
Cool )
So, to conclude, in Australia there're "mobile" numbers and "landline" numbers (like in any other country). "Landline" numbers can be written in:
1300 975 707
(An Australia-wide landline number)13 00 00
(An alternative Australia-wide landline number)So, considering that this library is made for inputting people's personal phone numbers (mostly mobile) and not for crawling the web for all possible numbers (like Google's library), it doesn't have to format ads numbers because people shouldn't input those in the input field
And if they've bought a fancy shortened number for themselves then they'd have to input a regular number just like all other normal people do. They're no "special", are they.
So we don't consider this a bug, rather a feature.
I've updated the readme note to include a link to this issue.
@ccg-tim Lube Mobile will come to you, just for $300
In Australia, 13-smart numbers (different from 1300 numbers, as 13-numbers are 6 digits long) do not correctly get formatted using the AsYouType formatter.
According to the Australian style guide (https://www.stylemanual.gov.au/style-rules-and-conventions/numbers-and-measurements/telephone-numbers) 6 digit 13 numbers should be written like this:
Using the AsYouTypeFormatter from the Google Demo, it gets rendered correctly.
Using libphonenumber-js, it gets rendered as
Google's demo link
https://libphonenumber.appspot.com/phonenumberparser?number=134578&country=AU