Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out pickup events that start in less than 2 days #246

Merged
merged 4 commits into from
May 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/pages/store/cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ 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 = new Date();
now.setDate(now.getDate() + 2);
nik-dange marked this conversation as resolved.
Show resolved Hide resolved
return startTime >= now;
})
);
const userPromise = getCurrentUserAndRefreshCookie(AUTH_TOKEN, { req, res });

Expand Down
Loading