stevekinney / node-phone-formatter

Parsing and formatting phone numbers so you don't have to.
MIT License
46 stars 11 forks source link

Bug with format #5

Open alexandr-bbm opened 7 years ago

alexandr-bbm commented 7 years ago

Please see the code example. The problem is that normalize cut first digit in phone number

var phoneFormatter = require('phone-formatter'); console.log(phoneFormatter.format('13338008404', 'NNN NNNN NNNN')); // "333 8008 404N"

https://runkit.com/582dacb99cde3d0013426605/582dacb99cde3d0013426606

Naskalin commented 6 years ago

same problem: phoneFormatter.format('881212345678', 'N (NNN) NNN-NN-NN')); // "(121) 234-56-7N"

davidlomidze commented 5 years ago

same problem: phoneFormatter.format('881212345678', 'N (NNN) NNN-NN-NN')); // "(121) 234-56-7N"

Disable normalization by adding third param {normalize: true}, true actually disables it 😕

phoneFormatter.format('881212345678', 'N (NNN) NNN-NN-NN', {normalize: true});
aacassandra commented 1 year ago

Thankyou @davidlomidze , it works like charm