mmende / libphonenumber-geo-carrier Goto Github PK
View Code? Open in Web Editor NEWThis library includes the geocoding, carrier- and timezone-mapping functionalities that are not available in libphonenumber-js itself.
This library includes the geocoding, carrier- and timezone-mapping functionalities that are not available in libphonenumber-js itself.
Hello,
your project has issues decoding Czech phone numbers
const main2 = async () => {
const mobileNumber = parsePhoneNumberFromString('+420605582922')
console.log(mobileNumber.formatInternational()); // +420 605 582 922
const carrierEN = await carrier(mobileNumber) // T-Mobile
console.log(carrierEN);
console.log('-------------------------');
const mobileNumber2 = parsePhoneNumberFromString('+420779990001')
console.log(mobileNumber2.formatInternational()); // +420 779 990 001
const carrierEN2 = await carrier(mobileNumber2) // null, should also be T-Mobile
console.log(carrierEN2);
}
main2();
The issue seems to be in getPrefix
, that returns 3 digits (605 or 779 in above cases), the problem is, that the bson is defined as
{
'605': 'T-Mobile',
'77999': 'T-Mobile',
... and bunch of others
}
the prefix checking should not be based on international phone number format
Bronislav Klučka
I may be doing something wrong, but in all my tests so far, trying to determine the timezone of a US number seems to return every US timezone (or at least a lot, most of which don't make sense).
Take for example the number of the Sacramento Zoo, +19168085888
const number = parsePhoneNumber('+19168085888')
const tzs = await timezones(number)
/* tzs equals:
[
'America/Adak',
'America/Anchorage',
'America/Anguilla',
'America/Antigua',
'America/Barbados',
'America/Boise',
'America/Cayman',
'America/Chicago',
'America/Denver',
'America/Dominica',
'America/Edmonton',
'America/Fort_Nelson',
'America/Grand_Turk',
'America/Grenada',
'America/Halifax',
'America/Jamaica',
'America/Juneau',
'America/Los_Angeles',
'America/Lower_Princes',
'America/Montserrat',
'America/Nassau',
'America/New_York',
'America/North_Dakota/Center',
'America/Phoenix',
'America/Port_of_Spain',
'America/Puerto_Rico',
'America/Regina',
'America/Santo_Domingo',
'America/St_Johns',
'America/St_Kitts',
'America/St_Lucia',
'America/St_Thomas',
'America/St_Vincent',
'America/Toronto',
'America/Tortola',
'America/Vancouver',
'America/Winnipeg',
'Atlantic/Bermuda',
'Pacific/Guam',
'Pacific/Honolulu',
'Pacific/Pago_Pago',
'Pacific/Saipan'
] */
Am I doing something wrong here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.