Skip to content

Commit

Permalink
fix: don't show cancel button for ongoing (recurring) reservations
Browse files Browse the repository at this point in the history
  • Loading branch information
vincit-matu committed May 7, 2024
1 parent 43738b2 commit a92c688
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function RecurringReservationsView({
const forDisplay = reservations.map((x) => {
const buttons = [];
const startDate = new Date(x.begin);
const endDate = new Date(x.end);
const now = new Date();

if (x.state !== State.Denied) {
Expand All @@ -103,7 +104,7 @@ function RecurringReservationsView({
/>
);
}
if (startDate > now) {
if (endDate <= now) {
buttons.push(
<ReservationListButton
key="deny"
Expand All @@ -117,7 +118,7 @@ function RecurringReservationsView({
return {
date: startDate,
startTime: format(startDate, "H:mm"),
endTime: format(new Date(x.end), "H:mm"),
endTime: format(endDate, "H:mm"),
isRemoved: x.state === "DENIED",
buttons,
};
Expand Down

0 comments on commit a92c688

Please sign in to comment.