catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.81k stars 216 forks source link

formatPhoneNumber doesn't format properly #338

Closed LitvinenkoEvgeny closed 5 years ago

LitvinenkoEvgeny commented 5 years ago

https://libphonenumber.appspot.com/phonenumberparser?number=89020423527&country=RU


const { formatPhoneNumber, formatPhoneNumberIntl } = require('react-phone-number-input/max');

const value = '89020423527';
console.log(formatPhoneNumber(value)); // in fact - returns empty string
console.log(formatPhoneNumberIntl(value)); // same here

demo: https://codesandbox.io/s/intelligent-pascal-wpkz3

catamphetamine commented 5 years ago

Go to the readme and search for formatPhoneNumber — there's no such function anymore. Instead use parsePhoneNumberFromString().format(...).

LitvinenkoEvgeny commented 5 years ago

@catamphetamine https://github.com/catamphetamine/react-phone-number-input#use

catamphetamine commented 5 years ago

You're looking at the incorrect link. Look at this repo readme

LitvinenkoEvgeny commented 5 years ago

yes but i'm don't use this lib directly, and why react-phone-number-input does not encapsulate it?

catamphetamine commented 5 years ago

It's not clear what you mean and what you want