mirror of
https://github.com/OwethuManagedServices/oms-website-nextjs.git
synced 2025-12-17 15:38:09 +00:00
14 lines
346 B
TypeScript
14 lines
346 B
TypeScript
export const formatDate = (dateString?: string): string => {
|
|
if (!dateString) return "N/A";
|
|
try {
|
|
return new Date(dateString).toLocaleDateString("en-ZA", {
|
|
year: "numeric",
|
|
month: "long",
|
|
day: "numeric",
|
|
});
|
|
} catch (e) {
|
|
console.error("Invalid date format:", dateString, e);
|
|
return "Invalid Date";
|
|
}
|
|
};
|