feat: cache marka api responses
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
export function formatDate(date: Date): string {
|
||||
export function formatDate(date?: string | Date): string {
|
||||
if (!date) return "";
|
||||
if (typeof date === "string") {
|
||||
try {
|
||||
const d = new Date(date);
|
||||
return formatDate(d);
|
||||
} catch (_e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
const options = { year: "numeric", month: "long", day: "numeric" } as const;
|
||||
return new Intl.DateTimeFormat("en-US", options).format(date);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user