Merged in fix/signup-phone-validation (pull request #2378)
fix/editprofile-phonenumber-validation * fix/editprofile-phonenumber-validation Approved-by: Christian Andolf
This commit is contained in:
@@ -38,7 +38,7 @@ export const editProfileSchema = z
|
||||
editProfileErrors.PHONE_REQUIRED,
|
||||
editProfileErrors.PHONE_REQUESTED
|
||||
),
|
||||
phoneNumberCC: z.string(),
|
||||
phoneNumberCC: z.string().nullish(),
|
||||
|
||||
password: z.string().optional(),
|
||||
newPassword: z.literal("").optional().or(passwordValidator()),
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import parsePhoneNumberFromString, { type CountryCode } from "libphonenumber-js"
|
||||
|
||||
export function formatPhoneNumber(phoneNumber: string, phoneNumberCC: string) {
|
||||
const parsedPhonenumber = phoneNumberCC.length
|
||||
export function formatPhoneNumber(
|
||||
phoneNumber: string,
|
||||
phoneNumberCC?: string | null
|
||||
): string {
|
||||
const parsedPhonenumber = phoneNumberCC?.length
|
||||
? parsePhoneNumberFromString(
|
||||
phoneNumber,
|
||||
phoneNumberCC.toUpperCase() as CountryCode
|
||||
|
||||
Reference in New Issue
Block a user