array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
arr = arr.sort(function (a, b) {
var dateA = new Date(a.date_prop).getTime();
var dateB = new Date(b.date_prop).getTime();
return dateA < dateB ? 1 : -1; // ? -1 : 1 for ascending/increasing order
});