import { Booking } from "@repo/db";

export const formatTimeRange = (booking: Booking, options?: { includeDate?: boolean }) => {
	const start = new Date(booking.startTime);
	const end = new Date(booking.endTime);
	const timeRange = `${start.toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit" })} - ${end.toLocaleTimeString("de-DE", { hour: "2-digit", minute: "2-digit" })}`;
	if (options?.includeDate) {
		return `${start.toLocaleDateString("de-DE")} ${timeRange}`;
	}
	return timeRange;
};
