11 lines
277 B
TypeScript
11 lines
277 B
TypeScript
export const formatDate = (date: string) => {
|
|
if (!date) return null;
|
|
const [day, month, year] = date.split(".");
|
|
const d = new Date(`${year}-${month}-${day}`);
|
|
return d.toLocaleDateString("en-US", {
|
|
month: "long",
|
|
day: "numeric",
|
|
year: "numeric",
|
|
});
|
|
};
|