Sort by dates, this is what you want:
y.sort(function(a,b) { return new Date(a.ts) < new Date(b.ts); });
forked fiddle http://jsfiddle.net/bHh4g/
Accidentally deleted console.log(y); in the violin, but reinsert it, showing that it is now sorted correctly.
Finally
It turns out that FireFox / Safari Date() does not match the dates in the form " 2013-09-24 14:44:22 " they need instead of y / m / d:
y.sort(function(a,b) { var d1 = a.ts.replace(/-/g,'/'); var d2 = b.ts.replace(/-/g,'/'); d1 = new Date(d1); d2 = new Date(d2); return (d1 < d2) ? -1 : (d1 > d2) ? 1 : 0; }); console.log(y);
forked fiddle http://jsfiddle.net/Jnx4w/
works like in Chrome / FF.
source share