الملفات
boutmoun123 8863f61d00
فشلت بعض الفحوصات
Deploy To Ghaymah / deploy (push) Has been cancelled
Add Oudelaa dashboard API integration
2026-05-25 20:36:52 +03:00

29 أسطر
722 B
TypeScript

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";
}