I have a problem to sort my object arrays by Date values. I found many questions that other users asked before, I went through all possible solutions and I still did not get solution for my sorting problem. I created two different arrays to test sort function too but still could not get dates in correct order. Here is my data:

```
[Object { eventDate="12/12/2016",  display_order="5"},Object { eventDate="12/12/2016",  display_order="3"}]

[Object { eventDate="04/21/2016",  display_order="3"},Object { eventDate="04/21/2016",  display_order="1"}]

```

I used this logic to sort my data by date values:

```
entries.sort(function(a,b){
    var i = new Date(a.eventDate);
    var j = new Date(b.eventDate);
    return i-j;
});

```

My data still did not sort in correct order using this function. Then I also tried to sort my array that looks like this:

```
var dates = Object.keys(groupedByDate);

console.log(dates)

```

This is output for variable dates: `["12/12/2016", "04/21/2016"]`

Then I tried to do this: 

```
dates.sort(function(a, b) {
    a = new Date(a.dates);
    b = new Date(b.dates);
    return a>b ? -1 : a<b ? 1 : 0;
});

```

My output still did not sort my dates in correct order. I'm not sure am I doing something wrong or something else could be a problem in this case. If anyone can help please let me know. Thanks.