diff --git a/pages/bookings/index.tsx b/pages/bookings/index.tsx
index dbcaadf875..0880f37a04 100644
--- a/pages/bookings/index.tsx
+++ b/pages/bookings/index.tsx
@@ -3,6 +3,8 @@ import prisma from "../../lib/prisma";
import { getSession, useSession } from "next-auth/client";
import Shell from "../../components/Shell";
import { useRouter } from "next/router";
+import dayjs from "dayjs";
+
export default function Bookings({ bookings }) {
const [, loading] = useSession();
@@ -49,11 +51,12 @@ export default function Bookings({ bookings }) {
className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Event
- {/*
Date
- | */}
+
+ {console.log(bookings)}
Actions
|
@@ -86,11 +89,14 @@ export default function Bookings({ bookings }) {
{booking.title}
{booking.description}
- {/*
-
- {dayjs(booking.startTime).format("D MMMM YYYY HH:mm")}
-
- | */}
+
+
+ {dayjs(booking.startTime).format("D MMMM YYYY")}
+
+
+ {dayjs(booking.startTime).format("HH:mm")} - {dayjs(booking.endTime).format("HH:mm")}
+
+ |
{!booking.confirmed && !booking.rejected && (
<>
@@ -153,7 +159,7 @@ export async function getServerSideProps(context) {
},
});
- const bookings = await prisma.booking.findMany({
+ let b = await prisma.booking.findMany({
where: {
userId: user.id,
},
@@ -165,11 +171,17 @@ export async function getServerSideProps(context) {
confirmed: true,
rejected: true,
id: true,
+ startTime: true,
+ endTime: true,
},
orderBy: {
- startTime: "desc",
+ startTime: "asc",
},
});
+ const bookings = b.map(booking=>{
+ return ({...booking, startTime:booking.startTime.toISOString(), endTime:booking.endTime.toISOString(),})
+ });
+
return { props: { bookings } };
}
|