I have a JavaScritpt Date sorting question. I have an array of up to 24 dates that I need to sort in descending order. The dates were formatted in a full date format. I successfully converted to a mm/dd/yyyy. I realized that I cannot use sort and I believe I need to run a comparisons of sort.
My dates appear as below
eventDatesArrray = ,11/30/2014,12/31/2018,12/31/2013,10/11/2016,10/12/2015
I did reference Sort Javascript Object Array By Date. My apologies, but I do not believe I completely understand how it works since the I continue to receive an error message stating that I am not passing the parameters. Not certain how to pass a and b to this function.
var sortedEventDates = eventDatesArrray .sort(function(a, b) {
return a>b ? -1 : a<b ? 1 : 0;
});
Thank you in advance for your help. Allison