Here's an array of items to work with:
myArray = [
{
someDate: "2018-01-11T00:00:00",
name: "John Smith",
level: 5000
},
{
someDate: "2017-12-18T00:00:00",
name: "Jane Doe",
level: 1000
},
{
someDate: "2016-12-18T00:00:00",
name: "Jack Black",
level: 2500
}
]
I'm attempting to arrange this array based on the date. Sorting arrays by simple properties isn't new to me:
Sorting JavaScript Object Array By Date
array.sort(function(a,b){
return new Date(b.date) - new Date(a.date);
});
However, I'm curious about sorting an array by its item properties. Any suggestions or tips would be appreciated.
EDIT: The date strings provided are indeed unusual and not in standard format due to a specific web service.