/**
 * Return a readable date time
 * e.G. Samstag 13-01-2024, 12:00 Uhr
 * With endDate: Samstag 13-01-2024, 12:00 Uhr bis 14:00 Uhr
 */
export const readableDateTime = (date: string, endDate?: string | null) => {
  const dateObj = new Date(date);
  const dayName = dateObj.toLocaleDateString("de-DE", { weekday: "long" });
  const normalDate = dateObj.toLocaleDateString("de-DE", { dateStyle: "medium" });
  const time = dateObj.toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
  const base = `${dayName} ${normalDate}, ${time} Uhr`;
  if (!endDate) return base;
  const endTime = new Date(endDate).toLocaleTimeString("de-DE", { timeStyle: "short", timeZone: "Europe/Berlin" });
  return `${base} bis ${endTime} Uhr`;
}