knockout.js - Knockoutjs - .sort() sorting in reverse order in Safari -
in knockout view model have following:
this.files.sort(function(f1, f2) { if (mostrecentfirst) { return f1.creationdate < f2.creationdate ? -1 : 1; } else { return f1.creationdate > f2.creationdate ? -1 : 1; } });
in firefox, chrome , ie sorts expected.
but in safari sorts in reverse order.
any suggestions why happening?
update: creationdate property contains json date string, eg "2013-04-26t12:08:02".
update 2: i've got around problem using push or unshift add elements array, isn't great solution because assumes data presented has been ordered. it's no longer immediate problem i'd still know why safari sorting in reverse order.
Comments
Post a Comment