File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
src/app/(main)/community/events Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -47,15 +47,26 @@ export async function getAllEvents() {
4747
4848 for ( const meetup of meetups ) {
4949 const { next, prev } = meetup . node
50+
51+ // if next is in the past we treat it as past event
5052 if ( next && new Date ( next ) < now ) {
5153 pastEvents . push ( meetup )
52- } else {
53- upcomingEvents . push ( meetup )
54+ }
55+ // if prev is in the past it is obviously a past event
56+ else if ( prev && new Date ( prev ) < now ) {
5457 pastEvents . push ( {
55- ...meetup ,
56- date : prev ,
58+ node : {
59+ ...meetup . node ,
60+ // we disregard .next, it's checked in nexdt if statement
61+ next : "" ,
62+ } ,
5763 } )
5864 }
65+
66+ // if next is in the future, it is an upcoming event
67+ if ( next && new Date ( next ) >= now ) {
68+ upcomingEvents . push ( meetup )
69+ }
5970 }
6071
6172 const getDate = ( event : AnyEvent ) => {
You can’t perform that action at this time.
0 commit comments