This commit is contained in:
2026-07-02 00:34:07 +03:30
parent e097f6b2bb
commit a41dd6ef9e
12 changed files with 93 additions and 26 deletions
+24 -2
View File
@@ -19,11 +19,33 @@ export function shouldNormalizeInputDigits(options: {
inputmode?: string
}): boolean {
if (options.isPassword) {
return false
return true
}
if (options.type === 'price' || options.type === 'number') {
const type = String(options.type ?? '').trim().toLowerCase()
if (type === 'price' || type === 'number' || type === 'tel') {
return true
}
const mode = String(options.inputmode ?? '').trim().toLowerCase()
return mode === 'numeric' || mode === 'decimal' || mode === 'number'
}
/** تبدیل ارقام فارسی/عربی در فیلدهای عددی فرم‌های احراز هویت و پروفایل */
export function normalizeAuthFormFields(fields: {
mobile?: string | null
password?: string | null
token?: string | null
n_code?: string | number | null
}) {
if (fields.mobile != null && fields.mobile !== '') {
fields.mobile = persianToEnglishDigits(String(fields.mobile).trim())
}
if (fields.password != null && fields.password !== '') {
fields.password = persianToEnglishDigits(String(fields.password))
}
if (fields.token != null && fields.token !== '') {
fields.token = persianToEnglishDigits(String(fields.token).trim())
}
if (fields.n_code != null && fields.n_code !== '') {
fields.n_code = persianToEnglishDigits(String(fields.n_code).trim())
}
}