data = {
start: 1,
data: [
{
name: 'Juan',
date: '2020-01-19
},
{
name: 'Carlo',
date: '2020-03-01
},
{
name: 'Dela',
date: '2020-03-01
},
{
name: 'Cruz',
date: '2021-04-01
}
],
totalRecords: 19
}
What I'm trying to do filter the data to the latest date which is 2020-04-01.
What I tried is like this:
response['data']['data'] = response['data']['data'].filter(item => {
return item['date'] > '2020-04-01';
});
But it doesn't work.
Expected output should be like this
data = {
start: 1,
data: [
{
name: 'Cruz',
date: '2021-04-01
}
],
totalRecords: 19
}