handle register and poster and fix bugs
This commit is contained in:
+2
-3
@@ -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, "")}`;
|
||||
|
||||
Reference in New Issue
Block a user