fix: harden booking and meeting flows

This commit is contained in:
2026-09-17 02:42:27 +02:00
parent cb30ecade9
commit 66710fc65c
42 changed files with 683 additions and 608 deletions
+9
View File
@@ -2,6 +2,15 @@ const BERLIN_TZ = "Europe/Berlin";
export type CalendarDate = { year: number; month: number; day: number };
/** Strict calendar input, interpreted in Berlin regardless of server TZ. */
export function parseBerlinDate(value: string): Date | null {
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return null;
const [year, month, day] = value.split("-").map(Number);
if (year < 1000 || month < 1 || month > 12 || day < 1 || day > 31) return null;
const date = berlinWallTimeToUTC({ year, month, day }, 0, 0);
return berlinDateKey(date) === value ? date : null;
}
export function berlinDateKey(date: Date): string {
const { year, month, day } = berlinParts(date);
return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`;