Skip to content

Commit

Permalink
fix: Handle event.date being undefined in closeCheckins
Browse files Browse the repository at this point in the history
  • Loading branch information
trillium committed Nov 10, 2023
1 parent d6d81a1 commit 8a56f1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/workers/closeCheckins.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 8a56f1c

Please sign in to comment.