handle register and poster and fix bugs

This commit is contained in:
Ehsan
2025-05-21 23:35:55 +03:30
parent 81f8042f6c
commit c469f2ee3c
23 changed files with 512 additions and 147 deletions
+2 -3
View File
@@ -174,15 +174,14 @@ export const filterList = (data) => {
export function getCleanNumberValue(value, defaultValue = 0) {
if (typeof value !== "string") value = String(value);
// Convert Persian and Arabic digits to English digits
const persianArabicToEnglish = value
.replace(/[\u06F0-\u06F9]/g, (d) => String(d.charCodeAt(0) - 0x06f0))
.replace(/[\u0660-\u0669]/g, (d) => String(d.charCodeAt(0) - 0x0660));
// Remove non-numeric characters except dots (for decimal support)
const cleaned = persianArabicToEnglish.replace(/[^0-9.]/g, "");
// Return number or default if invalid
const number = parseFloat(cleaned);
return isNaN(number) ? defaultValue : number;
}
export const changeNumToDefault = (num) => `09${num.replace(/\D/g, "")}`;