profilePage/src/helpers/char.ts
2025-04-05 01:28:29 -04:00

6 lines
271 B
TypeScript

export function timestampToReadable(timestamp?: number): string {
const date: Date =
timestamp && !isNaN(timestamp) ? new Date(timestamp) : new Date();
if (isNaN(date.getTime())) return "Invalid Date";
return date.toISOString().replace("T", " ").replace("Z", "");
}