I\'m trying to sort an Array of dates from latest to oldest, and unfortunately list.sort (by default) only sorts the first number. My array looks like this:
var
Here's a solution that doesn't reply on any constants.
var MyArray = ["13 Jun", "09 Jun", "25 Aug", "30 Jun", "13 Aug"];
var DateArray = [];
var SortedArray = [];
var dateBits;
for (var index = 0; index < MyArray.length; index++) {
DateArray.push(new Date(MyArray[index] + " 2000"));
}
SortedArray = DateArray.sort();
MyArray = [];
for (var index = 0; index < SortedArray.length; index++) {
dateBits = SortedArray[0].toDateString().substr(4, 6).split(" ");
MyArray[index] = dateBits[1] + " " + dateBits[0];
}