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.77k stars 218 forks source link

`parsePhoneNumberFromString` issue with E164 format for an Australian number #375

Closed imranariffin closed 4 years ago

imranariffin commented 4 years ago
import { parsePhoneNumberFromString } from 'libphonenumber-js/mobile'
const parsed = parsePhoneNumber('61438331999', 'AU')
console.log(parsed.format('E.164'))
// expected: '+61438331999' (as per Google)
// actual: '+6161438331999'

See Google's result

catamphetamine commented 4 years ago

This topic has been discussed before: https://github.com/catamphetamine/libphonenumber-js/issues/316 There's a workaround in the last comment. What is a scenario in which such error correction would be required?

imranariffin commented 4 years ago

Thanks for the swift response @catamphetamine. No specific scenario actually but after going over the discussion you mentioned it seems like this is not a bug but rather feature in this library.

catamphetamine commented 4 years ago

@imranariffin Actually, released libphonenumber-js@1.7.41 with the leading + autocorrection feature.

imranariffin commented 4 years ago

@imranariffin Actually, released libphonenumber-js@1.7.41 with the leading + autocorrection feature.

I see, thanks for the update. I was using 1.7.31 so that makes sense. I will try upgrading and testing it again.