In the function, I get the key endDate
and value of 03-10-2000
and 01-10-2000
. I want to filter by those two conditions given. So I check if the end date is between two date ranges. So the end result would be as below as only that object is in between two date ranges.
date= [{endDate:'03-10-2000', customerName:'Jay', startDate:'17-12-2000'}]
.
Update
function(_key, _startDate, _endDate){
//here key ='endDate'.. so I need to make use of the key..
this.data = data.filter(item => item._key > '01-10-2000' && item._key < '03-10-2000')
}
update 2 this is what I can think of
cost emptyArray = [];
Object.keys(this.data).forEach(function(key) {
if(key == this.key && this.data[key] >= this.startDate &&
this.data[key]>=this.endDate)
{
emptyArray.push(this.data[key])
}
});
Example data
date = [
{endDate:'12-12-2000', customerName:'Joe', startDate:'15-12-2000'},
{endDate:'03-10-2000', customerName:'Jay', startDate:'17-12-2000'},
{endDate:'02-12-2000', customerName:'Kim', startDate:'11-12-2000'}
];