echo/src/lib/char.ts
creations d554599768
All checks were successful
Code quality checks / biome (push) Successful in 7s
first commit
2025-05-24 09:42:42 -04:00

8 lines
311 B
TypeScript

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