Hi there,
This approach appears to be working. I updated the test app to showcase this. The following is the gist of it.
var randomDates = [
new Date(2021, 0, 11, 13, 52, 59, 452),
new Date(2021, 0, 11, 13, 32, 58, 956),
new Date(2021, 0, 12, 13, 55, 33, 216),
new Date(2021, 0, 11, 14, 02, 56, 873),
new Date(2021, 0, 11, 14, 22, 44, 315),
new Date(2021, 0, 11, 14, 44, 21, 273),
new Date(2021, 0, 11, 15, 02, 24, 093),
new Date(2021, 0, 11, 17, 49, 56, 344),
new Date(2021, 0, 12, 1, 08, 45, 504),
new Date(2021, 0, 12, 1, 54, 36, 290),
new Date(2021, 0, 12, 8, 31, 16, 087),
new Date(2021, 0, 11, 16, 34, 05, 781),
new Date(2000, 0, 11, 16, 36, 11, 802),
];
var date_sort_asc = function (date1, date2) {
if (date1 > date2) return 1;
if (date1 < date2) return -1;
return 0;
};
randomDates.sort(date_sort_asc);
randomDates.forEach(function(dt){
console.log(dt.toLocaleString())
});