🚸 (phone) Improve phone input behavior and validation
Now accepting landline phone numbers. Consistent select UI on every browser. Auto focus on country select.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import phone from 'phone'
|
||||
import { parsePhoneNumber } from 'libphonenumber-js'
|
||||
|
||||
export const formatPhoneNumber = (phoneNumber: string) =>
|
||||
phone(phoneNumber).phoneNumber
|
||||
parsePhoneNumber(phoneNumber).formatInternational()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { phone } from 'phone'
|
||||
import { isValidPhoneNumber } from 'libphonenumber-js'
|
||||
|
||||
export const validatePhoneNumber = (phoneNumber: string) =>
|
||||
phone(phoneNumber).isValid
|
||||
isValidPhoneNumber(phoneNumber)
|
||||
|
||||
Reference in New Issue
Block a user