Booking Panel auf Dashboard
This commit is contained in:
11
apps/hub/helper/timerange.ts
Normal file
11
apps/hub/helper/timerange.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user