I have two arrays like so:
const exhibitiontypes = [
{
title: 'Past Exhibitions',
type: 'past',
},
{
title: 'Current Exhibitions',
type: 'current',
},
{
title: 'Upcoming Exhibitions',
type: 'upcoming',
},
]
And
const exhibitions = [
{
name: 'Exhibition 1',
startdate: new Date(2021, 08, 10),
enddate: new (2021, 08, 15)
},
{
name: 'Exhibition 2',
startdate: new Date(2020, 08, 13),
enddate: new Date(2020, 09, 25)
},
{
name: 'Exhibition 3',
startdate: new Date(),
enddate: new Date(2021, 08, 5)
}
]
And in my app, I map through the exhibition types and return an exhibitiontypepage, whcih would contain the past, current or upcoming exhibitions based on the start and end date of each exhibition.
const exhibitiontypes.map(type=> {
return <Exhibitiontypepage exhibitions={?} type={type}/>
})
How can I filter the array of exhibitions to match only if the exhibition is in the past, present or future?