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:
Linus Flood
2025-06-17 11:56:58 +00:00
parent f559703de7
commit a29f2b94a7
2 changed files with 6 additions and 3 deletions

View File

@@ -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()),

View File

@@ -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