FIX - normalize numeric phone values

This commit is contained in:
Leon.Schmidt
2026-08-06 18:31:04 +02:00
parent b71181a4e9
commit 79b9279f25
+2 -2
View File
@@ -5,8 +5,8 @@ export function normalizePhoneNumber(value: string): string | null {
return digits.length === PHONE_NUMBER_LENGTH ? digits : null
}
export function formatPhoneNumber(value: string): string {
const digits = value.replace(/\D/g, '').slice(0, PHONE_NUMBER_LENGTH)
export function formatPhoneNumber(value: string | number): string {
const digits = String(value).replace(/\D/g, '').slice(0, PHONE_NUMBER_LENGTH)
const groups = [digits.slice(0, 3), digits.slice(3, 6), digits.slice(6, 10)]
return groups.filter(Boolean).join(' ')
}