Add Oudelaa dashboard API integration
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
هذا الالتزام موجود في:
28
oudelaa_dashboard/lib/format.ts
Normal file
28
oudelaa_dashboard/lib/format.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
export function formatDateTime(value?: string | null) {
|
||||
if (!value) return "-";
|
||||
try {
|
||||
return new Intl.DateTimeFormat("ar-SA", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "short",
|
||||
}).format(new Date(value));
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
export function formatCurrency(value?: number | null, currency = "SAR") {
|
||||
if (typeof value !== "number") return "-";
|
||||
try {
|
||||
return new Intl.NumberFormat("en-US", {
|
||||
style: "currency",
|
||||
currency,
|
||||
maximumFractionDigits: 0,
|
||||
}).format(value);
|
||||
} catch {
|
||||
return `${value} ${currency}`;
|
||||
}
|
||||
}
|
||||
|
||||
export function formatCount(value?: number | null) {
|
||||
return typeof value === "number" ? new Intl.NumberFormat("en-US").format(value) : "0";
|
||||
}
|
||||
المرجع في مشكلة جديدة
حظر مستخدم