aboutsummaryrefslogtreecommitdiffstats
path: root/pelican-bootstrap3/static/js/github.js
diff options
context:
space:
mode:
Diffstat (limited to 'pelican-bootstrap3/static/js/github.js')
-rw-r--r--pelican-bootstrap3/static/js/github.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/pelican-bootstrap3/static/js/github.js b/pelican-bootstrap3/static/js/github.js
index 0ac60ef..7bdb6a4 100644
--- a/pelican-bootstrap3/static/js/github.js
+++ b/pelican-bootstrap3/static/js/github.js
@@ -24,11 +24,13 @@ var github = (function(){
repos.push(data.data[i]);
}
repos.sort(function(a, b) {
- if (a[options.sort_attribute] > b[options.sort_attribute]) { return 1; }
- if (a[options.sort_attribute] < b[options.sort_attribute]) { return -1; }
- return 0;
+ var aDate = new Date(a.pushed_at).valueOf(),
+ bDate = new Date(b.pushed_at).valueOf();
+
+ if (aDate === bDate) { return 0; }
+ return aDate > bDate ? -1 : 1;
});
- if (options.sort_descending) { repos.reverse(); }
+
if (options.count) { repos.splice(options.count); }
render(options.target, repos);
}