Initial commit - Route Commerce platform

This commit is contained in:
2026-06-01 19:40:55 +00:00
commit 53a9671461
617 changed files with 106132 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
/**
* Shared date/time formatting utilities for Route Commerce.
* All dates are stored as TIMESTAMPTZ in PostgreSQL (UTC).
* Display dates in MM/DD/YYYY format in US locale.
*/
export function formatDate(date: string | Date | null | undefined): string {
if (!date) return "—";
const d = typeof date === "string" ? new Date(date) : date;
if (isNaN(d.getTime())) return "—";
return d.toLocaleDateString("en-US", {
month: "2-digit",
day: "2-digit",
year: "numeric",
});
}
export function formatDateTime(date: string | Date | null | undefined): string {
if (!date) return "—";
const d = typeof date === "string" ? new Date(date) : date;
if (isNaN(d.getTime())) return "—";
return d.toLocaleDateString("en-US", {
month: "2-digit",
day: "2-digit",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
});
}
export function formatTime(date: string | Date | null | undefined): string {
if (!date) return "—";
const d = typeof date === "string" ? new Date(date) : date;
if (isNaN(d.getTime())) return "—";
return d.toLocaleTimeString("en-US", {
hour: "2-digit",
minute: "2-digit",
});
}