I have an Angular ng-repeat statement which I need to order by the date field (entry_date). So far it is only ordering by the month and the day using this code:
<tbody ng-repeat="transaction in transactions | orderBy:'-entry_date'">
<tr>
<td>
<input ng-model="transaction.selected" type="checkbox"/>
</td>
<td>
<span>{{ transaction.entry_date | date:'yyyy-MM-dd HH:mm' }}</span>
</td>
<td>
<span>{{ transaction.description }}</span>
</td>
</tr>
</tbody>
</table>
Here is the entry date value pulled from console: "2011-06-30T08:17:35Z"
And here is the table of dates first page:
2011-06-30 09:17
2011-06-29 12:47
2011-06-29 08:20
Here is the last page:
2017-02-12 01:00
2017-02-12 01:00
2017-02-12 01:00
2017-02-12 01:00
2017-02-11 01:00
I have also tried using a callback function:
$scope.sortDates = function(transaction) {
var date = new Date(transaction.entry_date);
return date;
};
But this just returns the data in the same way as my original code.
Is there a way to get the filter to use the year AND the month/date?
Thanks in advance.