i am trying to filter an array based on dates.
var items = [
{
createdBy: "suriyan"
product: "tv"
from: "2019-10-15T18:30:00.000Z"
to: "2019-10-29T18:30:00.000Z"
},
{
createdBy: "suriyan"
product: "phone"
from: "2019-10-19T18:30:00.000Z"
to: "2019-10-29T18:30:00.000Z"
}
]
filtered:[];
for(let i=0;i<this.items.length;i++){
const now = new Date();
if(now>this.items[i].from){
this.filtered.push(this.items[i])
}
}
console.log(this.filtered);
but this is not working for me. Can someone help me on this. Thanks in advance