Fix country detection, fix phone number formatting, close #103

This commit is contained in:
Pieter Vander Vennet 2020-09-26 01:43:20 +02:00
parent 48ca24261f
commit cba72ea915
3 changed files with 14 additions and 9 deletions

View file

@ -87,11 +87,13 @@ export default class ValidatedTextField {
"phone",
"A phone number",
(str, country: any) => {
if (str === undefined) {
return false;
}
return parsePhoneNumberFromString(str, country?.toUpperCase())?.isValid() ?? false
},
(str, country: any) => {
console.log("reformatting phone nuber",str, "for locale", country)
return parsePhoneNumberFromString(str, country?.toUpperCase()).formatInternational()
return parsePhoneNumberFromString(str, country?.toUpperCase()).formatInternational()
}
)
]