Created
June 27, 2013 23:31
-
-
Save m2web/5881298 to your computer and use it in GitHub Desktop.
Jasmine DateSort2.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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