Once all orders are fetched client side, order them all, newest first
This commit is contained in:
parent
af7ac97622
commit
c9ce1a2bd9
|
@ -43,6 +43,24 @@
|
||||||
var orderindex,
|
var orderindex,
|
||||||
currentOrder;
|
currentOrder;
|
||||||
|
|
||||||
|
// Sort orders, newest first
|
||||||
|
orders.sort(function( a, b ) {
|
||||||
|
var adate, bdate;
|
||||||
|
|
||||||
|
adate = Date.parse( a.date_created_gmt );
|
||||||
|
bdate = Date.parse( b.date_created_gmt );
|
||||||
|
|
||||||
|
if ( adate === bdate ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( adate < bdate ) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for ( orderindex in orders ) {
|
for ( orderindex in orders ) {
|
||||||
currentOrder = orders[ orderindex ];
|
currentOrder = orders[ orderindex ];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue