Skip to content

Commit

Permalink
fix: remove todays reservastions from past list
Browse files Browse the repository at this point in the history
  • Loading branch information
joonatank committed Feb 22, 2024
1 parent 62def40 commit ba7585b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/ui/pages/reservations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Head from "@/components/reservations/Head";
import { CenterSpinner } from "@/components/common/common";
import { getCommonServerSideProps } from "@/modules/serverUtils";
import { toApiDate } from "common/src/common/util";
import { addDays } from "date-fns";

export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
const { locale } = ctx;
Expand Down Expand Up @@ -106,8 +107,9 @@ const Reservations = (): JSX.Element | null => {
],
orderBy: tab === "upcoming" ? "begin" : "-begin",
user: currentUser?.pk?.toString(),
// NOTE today's reservations are always shown in upcoming (even when they are in the past)
beginDate: tab === "upcoming" ? toApiDate(today) : undefined,
endDate: tab === "past" ? toApiDate(today) : undefined,
endDate: tab === "past" ? toApiDate(addDays(today, -1)) : undefined,
},
});

Expand Down

0 comments on commit ba7585b

Please sign in to comment.