chore: first commit

This commit is contained in:
mahyargdz
2025-06-24 11:26:06 +03:30
commit ccbf743ecb
186 changed files with 22258 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
export function numberFormat(number: number, locale: string = "fa-IR") {
return Intl.NumberFormat(locale).format(number);
}
export function dateFormat(date: Date | string | number, locale: string = "fa-IR") {
try {
// Convert to Date object if it's a string or number
const dateObj = date instanceof Date ? date : new Date(date);
// Check if the date is valid
if (isNaN(dateObj.getTime())) {
console.warn("Invalid date provided to dateFormat:", date);
return "Invalid Date";
}
return new Intl.DateTimeFormat(locale).format(dateObj);
} catch (error) {
console.error("Error formatting date:", error);
return "Invalid Date";
}
}