I have an application that creates and controls actions. I am using Knockout.js to store activity in an observable array. Whenever a new activity is created, it is inserted into the array. One of the properties of an activity is a date. I want to order actions by date after creating a new one in order to display it correctly in the user interface. This is the function I use for it:
self.Activities.unshift(activity); self.Activities.sort(function(a, b) { var dateA = new Date(a.date() + " 00:00:00"); var dateB = new Date(b.date() + " 00:00:00"); return dateA > dateB; });
And it works fine in Firefox (v 16.0.2), but it doesnβt work in Chrome (v 23.0.1 ...), Safari or IE
Why? What is the workaround? If there?
source share