Skip to content

Commit

Permalink
maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois committed Jun 16, 2024
1 parent ddc1753 commit 300a2cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/models/reservation.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { User, Reservation } from "@prisma/client";
import { addDays, addHours, compareAsc, differenceInMinutes, startOfDay, startOfToday } from "date-fns";
import { addDays, addHours, compareAsc, differenceInMinutes, startOfDay, startOfToday, subHours } from "date-fns";

import { prisma } from "~/db.server";

Expand Down Expand Up @@ -34,7 +34,7 @@ export async function createReservation({
}) {
const serverOffset = new Date().getTimezoneOffset() / 60
const offset = 7 - serverOffset
const offsetStart = addHours(start, offset)
const offsetStart = subHours(start, offset)

console.log(offset)

Expand Down Expand Up @@ -67,7 +67,7 @@ export async function createReservation({
}

// TODO: warn if after dusk
if (compareAsc(addHours(end, offset), addHours(startOfDay(offsetStart), 20)) === 1) {
if (compareAsc(subHours(end, offset), addHours(startOfDay(offsetStart), 20)) === 1) {
throw new Error('Reservations must conclude by 20:00')
}

Expand Down
4 changes: 2 additions & 2 deletions app/routes/ReservationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export const ReservationList = ({
court="pb"
date={date}
/>
{/* <TimeSlots
<TimeSlots
reservations={existingReservations.filter((r) => r.court === "bball")}
isLoggedIn={!!user}
court="bball"
Expand All @@ -249,7 +249,7 @@ export const ReservationList = ({
isLoggedIn={!!user}
court="10s"
date={date}
/> */}
/>
</main>
</React.Fragment>
));
Expand Down

0 comments on commit 300a2cc

Please sign in to comment.