Hacker News new | ask | show | jobs
by jackocnr 4244 days ago
Ha, good to see this here - so incredibly useful, and already ported to lots of useful languages. Handling phone numbers gets messy really quickly: formatting/validation for national/international numbers, in different forms (land-line/mobile/premium etc), in hundreds of different countries... These guys have done a great job, and are also super responsive/helpful when you raise issues.

A word of warning: if you ever set out to handle international numbers in a web frontend - you may think "it can't be that hard - maybe take me a couple of hours" (like me), then do yourself a favour and save yourself a week of unexpected work and use the jQuery plugin that I ended up creating (I don't understand why this didn't already exist) which uses libphonenumber for all the magic: https://github.com/Bluefieldscom/intl-tel-input. Hope it saves you some time.

5 comments

Looks awesome; will consider using this in the future.

One note: it would be nice if you explicitly stated, in the LICENSE file or the readme, that this is under the MIT license. It'd make it easier to use this at companies (like mine) where open source packages can only be used if their license is on a legal-department-approved whitelist.

What other licenses are usually on that list?
Done.
I did phone numbers validation in the front end, and I yes the expected couple hours ended up being multiple days of works and I ended up using google's validator!

thanks for the jquery plugin, I'll definitely keep it in mind!

That looks amazing.
Exactly what I was looking for! Thanks!
Please make this a node package at some point.
I have created a node package a couple of months ago which I regularly keep up-to-date with the latest upstream changes. It exports everything that the javascript version of libphonenumber offers. You can check it at http://seegno.github.io/google-libphonenumber/.