I want to filter a simple JSON file by date range. With a start date and and end date.
And this is my function:
var startDate = new Date("2013-3-25");
var endDate = new Date("2017-3-25");
var aDate = new Date();
var filteredData = this.orders.filter(function(a){
aDate = new Date(a.fecha);
aDate >= startDate && aDate <= endDate;
});
console.log(filteredData)
Here's my: fiddle
I'm expecting to get one object in my array, however the array is empty as you can see in the console.