question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with Valid SG mobile numbers returning No Type (as of 1.6.0)

See original GitHub issue

I have a case where a given number is returning no Type, whereas the same number in Google’s library (and other online checkers) correctly returns type “MOBILE”. This case works in libphonenumber-js versions prior to 1.6.0 (using older API - tested with 1.5.2), but anything later than 1.6.0 inclusive fails.

The number is +6584655555 (last 5 digits changed for privacy). I use Default Country “AU” (as that’s where I am, and most of our user). The library correctly identifies it as a Valid number from country “SG” - but the type is undefined.

Google Test: https://libphonenumber.appspot.com/phonenumberparser?number=%2B6584655555&country=AU

I have tried using “metadata.full.json” - although normally I use “metadata.mobile.json”.

Minimal script:

const PhoneUtil = require('libphonenumber-js')
const metadata = require('libphonenumber-js/metadata.full.json')

let number = PhoneUtil.parsePhoneNumberFromString('+6584685555', 'AU', metadata)
let type = number.getType(number)
console.log({number, type})

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
catamphetaminecommented, Jan 10, 2019

@Dortamur Oh, I get it now: you’re importing from the wrong package. See readme on min vs max vs mobile.

0reactions
dortamurcommented, Jan 15, 2019

Great! Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Libphonenumber-getexample NPM - npm.io
Returns phone number type (fixed line, mobile, toll free, etc) or undefined (if the number is invalid or if there are no phone...
Read more >
Phone number validation Android - Stack Overflow
Use isGlobalPhoneNumber() method of PhoneNumberUtils to detect whether a number is valid phone number or not. Example. System.out.println("....g1.
Read more >
Voice JavaScript SDK: Changelog - Twilio
Changelog for the Voice JavaScript SDK including new features, bug fixes and updates.
Read more >
Bug listing with status RESOLVED with resolution TEST ...
Error in sched.c line 961. ... Bug:40322 - "sys-apps/man creates /var/cache/man/cat* directories without write permission for man group" status:RESOLVED ...
Read more >
tMo - River Thames Conditions - Environment Agency - GOV.UK
#in Share video google drive, Cafe keko duisburg, Auspost tracking number digits, ... Mobile roadworthy melbourne, Baja mali knindza 2016, Nike employee ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found