Organize/lib/format.ts

12 lines
355 B
TypeScript

/** e.g. "Aug 12, 2026, 3:45 PM" -- absolute, not relative, so it doesn't
* need to be re-rendered on a timer just to stay accurate. */
export function formatDateTime(iso: string): string {
return new Date(iso).toLocaleString(undefined, {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "2-digit",
});
}