You can write your own sort function. Then call sort on your array
Using ES6 style
const compare = (a,b) => {
if (a.uploadedAt < b.uploadedAt)
return -1;
else if (a.uploadedAt > b.uploadedAt)
return 1;
else
return 0;
}
You need to merge your arrays into one array.
const data = firstArrayFromPromise.concat(secondArrayFromPromise)
Our array may looks like this
const data = [
{
uploadedAt: new Date(2016,0,1),
data : 'object1'
},
{
uploadedAt: new Date(2015,0,1),
data : 'object2'
},
{
uploadedAt: new Date(2016,0,1),
data : 'object3'
},
]
Show if it's working
console.log(data.sort(compare))