Initial commit

Next.js + Express event management app for Hope Family Church.
This commit is contained in:
2026-07-23 15:26:47 +02:00
commit fdd2d241b4
246 changed files with 57565 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
export function formatDate(input: string | number | Date | null | undefined): string {
if (input == null) return "";
const d = new Date(input);
if (isNaN(d.getTime())) return "";
// Use en-GB to ensure day-month-year with full month name, e.g., 20 March 2025
return new Intl.DateTimeFormat("en-GB", {
day: "2-digit",
month: "long",
year: "numeric",
}).format(d);
}
export function formatDateTime(input: string | number | Date | null | undefined): string {
if (input == null) return "";
const d = new Date(input);
if (isNaN(d.getTime())) return "";
return new Intl.DateTimeFormat("en-GB", {
day: "2-digit",
month: "long",
year: "numeric",
hour: "2-digit",
minute: "2-digit",
hour12: false,
}).format(d);
}
export function formatDateTimeRange(
start: string | number | Date | null | undefined,
end: string | number | Date | null | undefined
): string {
const startStr = formatDateTime(start);
const endStr = formatDateTime(end);
if (startStr && endStr) return `${startStr} — ${endStr}`;
if (startStr) return startStr;
if (endStr) return endStr;
return "";
}