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_REQUIRED,
|
||||||
editProfileErrors.PHONE_REQUESTED
|
editProfileErrors.PHONE_REQUESTED
|
||||||
),
|
),
|
||||||
phoneNumberCC: z.string(),
|
phoneNumberCC: z.string().nullish(),
|
||||||
|
|
||||||
password: z.string().optional(),
|
password: z.string().optional(),
|
||||||
newPassword: z.literal("").optional().or(passwordValidator()),
|
newPassword: z.literal("").optional().or(passwordValidator()),
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import parsePhoneNumberFromString, { type CountryCode } from "libphonenumber-js"
|
import parsePhoneNumberFromString, { type CountryCode } from "libphonenumber-js"
|
||||||
|
|
||||||
export function formatPhoneNumber(phoneNumber: string, phoneNumberCC: string) {
|
export function formatPhoneNumber(
|
||||||
const parsedPhonenumber = phoneNumberCC.length
|
phoneNumber: string,
|
||||||
|
phoneNumberCC?: string | null
|
||||||
|
): string {
|
||||||
|
const parsedPhonenumber = phoneNumberCC?.length
|
||||||
? parsePhoneNumberFromString(
|
? parsePhoneNumberFromString(
|
||||||
phoneNumber,
|
phoneNumber,
|
||||||
phoneNumberCC.toUpperCase() as CountryCode
|
phoneNumberCC.toUpperCase() as CountryCode
|
||||||
|
|||||||
Reference in New Issue
Block a user