Skip to content

Commit d59332d

Browse files
committed
Make withinBookingDeadline false if the event has expired
1 parent 76e5290 commit d59332d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/app/components/pages/EventDetails.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const EventDetails = ({match: {params: {eventId}}, location: {pathname}}:
7777
const canBeAddedToWaitingList =
7878
!canMakeABooking &&
7979
event.isNotClosed &&
80+
!event.hasExpired &&
8081
!event.userOnWaitList &&
8182
studentOnlyRestrictionSatisfied;
8283

src/app/services/events.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export const augmentEvent = (event: IsaacEventPageDTO): AugmentedEvent => {
1919
const endDate = new Date(event.endDate);
2020
augmentedEvent.isMultiDay = startDate.toDateString() != endDate.toDateString();
2121
augmentedEvent.hasExpired = now > endDate.getTime();
22-
augmentedEvent.isWithinBookingDeadline = event.bookingDeadline ? now <= new Date(event.bookingDeadline).getTime() : true;
2322
augmentedEvent.isInProgress = startDate.getTime() <= now && now <= endDate.getTime();
2423
} else {
2524
augmentedEvent.hasExpired = now > startDate.getTime();
2625
augmentedEvent.isInProgress = false;
2726
augmentedEvent.isMultiDay = false;
2827
}
28+
augmentedEvent.isWithinBookingDeadline =
29+
!augmentedEvent.hasExpired &&
30+
event.bookingDeadline ? now <= new Date(event.bookingDeadline).getTime() : true;
2931
}
3032

3133
if (event.tags) {

0 commit comments

Comments
 (0)