diff --git a/src/pages/store/cart.tsx b/src/pages/store/cart.tsx index fc5c694f..2df7b6e4 100644 --- a/src/pages/store/cart.tsx +++ b/src/pages/store/cart.tsx @@ -254,6 +254,14 @@ const getServerSidePropsFunc: GetServerSideProps = async ({ req, res }) => { .filter( event => !(event.orders && event.orderLimit && event.orders.length > event.orderLimit) ) + // filter out events that have a start time less than 2 days from now + .filter(event => { + const startTime = new Date(event.start); + const now = Date.now(); + const twoDaysInMs = 2 * 24 * 60 * 60 * 1000; + const twoDaysFromNow = new Date(now + twoDaysInMs); + return startTime >= twoDaysFromNow; + }) ); const userPromise = getCurrentUserAndRefreshCookie(AUTH_TOKEN, { req, res });