Giter Site home page Giter Site logo

mmende / libphonenumber-geo-carrier Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 2.0 319 KB

This library includes the geocoding, carrier- and timezone-mapping functionalities that are not available in libphonenumber-js itself.

JavaScript 39.93% TypeScript 60.07%

libphonenumber-geo-carrier's People

Contributors

dependabot[bot] avatar mmende avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kozakvoj

libphonenumber-geo-carrier's Issues

Czech carriers

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

Returns all US timeszones?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.