ı have json and ı can sort earlier very well but also ı want to remove item if it is past day (ı mean expired date).
loadProducts(){
this.myProvider.load()
.then(data => {
console.log(data);
this.products= data;
this.products.sort((x,y) => new Date(x.start_time).getTime() - new Date(y.start_time).getTime());**// this is how to sort**
}
if it is expired date ; it want to delete automacally. so please help me
In addition to @Tommertom’s (typically) excellent advice, I would suggest looking at date-fns to handle the ... bits instead of the manual Date arithmetic you’re doing now.