Skip to content

Invalid number error for Singapore number starting with +6589xxxxxx and +6580xxxxxx #30

@kingcashthefifth

Description

@kingcashthefifth

Hi @mattbornski ,
I have encountered an invalid number error while trying to do the following:

var libphonenumber = require('libphonenumber');

const testNum1 = '+6581002500';
const testNum2 = '+6582002500';
const testNum3 = '+6589002500';
const testNum4 = '+6580002500';

console.log('libphonenumber, testNum1: ', libphonenumber.validate(testNum1));
console.log('libphonenumber, testNum2: ', libphonenumber.validate(testNum2));
console.log('libphonenumber, testNum3 ', libphonenumber.validate(testNum3));
console.log('libphonenumber, testNum4: ', libphonenumber.validate(testNum4));

While using variables testNum3 and testNum4 to test, there was an error as follow:

Error: Invalid number
    at validateNumber (/home/runner/DenseDirectMiddleware/node_modules/libphonenumber/lib/index.js:53:21)
    at Object.validate (/home/runner/DenseDirectMiddleware/node_modules/libphonenumber/lib/index.js:99:23)
    at /home/runner/DenseDirectMiddleware/index.js:31:58
    at Script.runInContext (vm.js:131:20)
    at Object.<anonymous> (/run_dir/interp.js:156:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)

+6589xxxxxx and +6580xxxxxx are both valid singapore number formats.
Are you able to provide a fix for this?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions