Skip to content

Instantly share code, notes, and snippets.

@m2web
Created June 27, 2013 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m2web/5881298 to your computer and use it in GitHub Desktop.
Save m2web/5881298 to your computer and use it in GitHub Desktop.
Jasmine DateSort2.js
DateSort = function (){}
DateSort.prototype.sortAsc = function(theArray){
return theArray.sort(date_sort_asc);
}
var date_sort_asc = function(a,b){
a = new Date(a.publishDate);
b = new Date(b.publishDate);
return a<b ? -1 : a>b ? 1 : 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment