Looking to filter an array with multiple conditions? I have several checkboxes pre-checked and I need to filter based on start_date
and end_date
:
future:
start_date
is after todaypast:
end_date
is after today's datein_progress:
start_date
is today or later, butend_date
is not past today's date
<input v-model="future" type="checkbox" />
<input v-model="past" type="checkbox" />
<input v-model="in_progress" type="checkbox"/>
data: function () {
return {
past: true,
future: true
in_progress: true
items: [
{
"name":"Test",
"start_date":""2022-01-01T07:00:00-08:00"",
"end_date":""2022-03-01T07:00:00-08:00"",
"id":"2asfa3r9adsgu83yf83"
},
{
"name":"Test",
"start_date":""2020-01-01T07:00:00-08:00"",
"end_date":""2020-02-01T07:00:00-08:00"",
"id":"1asfa3r9adsgu83yf83"
},
{
"name":"Test",
"start_date":""2021-10-12T07:00:00-08:00"",
"end_date":""2022-10-19T07:00:00-08:00"",
"id":"6asfa3r9adsgu83yf83"
},
]
}
}