There is an array:
var a = new Array();
It contains date entries like this: ‘2012-09-12 09:20’, etc
I need to find minimum and maximum dates using javascript. This code does not work with time values.
var minT = Math.min.apply(Math, a);
var maxT = Math.max.apply(Math, a);
How can I solve this problem in javascript? It seems to be quite complex as I’m not very experienced in this language.
If your array contains
Dateobjects, then this should work. If it just contains strings like'2012-09-12 09:20', then you can sort them, and get the 1st and last elements.