add checkin boundaries

This commit is contained in:
chark1es 2025-03-01 01:37:44 -08:00
parent b7493224d2
commit 72ea5ba8df

View file

@ -113,9 +113,16 @@ const EventCheckIn = () => {
throw new Error("You have already checked in to this event");
}
// Check if the event hasn't ended yet
// Check if the event is active (has started and hasn't ended yet)
const currentTime = new Date();
const eventStartDate = new Date(event.start_date);
const eventEndDate = new Date(event.end_date);
if (eventEndDate < new Date()) {
if (eventStartDate > currentTime) {
throw new Error("This event has not started yet");
}
if (eventEndDate < currentTime) {
throw new Error("This event has already ended");
}