From 8a56f1c6cd7472435c1ddf0e6d9cf7e92c09cd1c Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Fri, 10 Nov 2023 12:58:57 -0800 Subject: [PATCH] fix: Handle event.date being undefined in closeCheckins --- backend/workers/closeCheckins.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/workers/closeCheckins.js b/backend/workers/closeCheckins.js index d2c64d20..9d04cd7d 100644 --- a/backend/workers/closeCheckins.js +++ b/backend/workers/closeCheckins.js @@ -28,6 +28,12 @@ module.exports = (cron, fetch) => { if (events && events.length > 0) { const sortedEvents = events.filter(event => { + if (!event.date) { + // handle if event date is null/undefined + // false meaning don't include in sortedEvents + return false + } + const currentTimeISO = new Date().toISOString(); const threeHoursFromStartTime = new Date(event.date).getTime() + 10800000; const threeHoursISO = new Date(threeHoursFromStartTime).toISOString();