summaryrefslogtreecommitdiff
path: root/media/archweb.js
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-02-01 00:18:36 -0600
committerDan McGee <dan@archlinux.org>2011-02-01 00:18:36 -0600
commitf1e476373a602327a5d23d2f92c7dc30ce2891fd (patch)
tree7d8d05262124147b7e185a4229d893679c9328e8 /media/archweb.js
parentdb911e291fc5fe17af2c07a6e94675694633dcf8 (diff)
Fix JS date parsing sort helper
How could I ever forget the awesomeness that is the JS date constructor that takes a month value between 0-11, not 1-12. Total insanity. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'media/archweb.js')
-rw-r--r--media/archweb.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/media/archweb.js b/media/archweb.js
index 330eeff9..52e817a4 100644
--- a/media/archweb.js
+++ b/media/archweb.js
@@ -58,9 +58,12 @@ if (typeof $.tablesorter !== 'undefined') {
var matches = this.re.exec(s);
if (!matches) return 0;
/* skip group 6, group 7 is optional seconds */
- if (matches[7] == undefined) matches[7] = '0';
- return $.tablesorter.formatFloat(new Date(
- matches[1],matches[2],matches[3],matches[4],matches[5],matches[7]).getTime());
+ if (matches[7] == undefined) matches[7] = 0;
+ /* The awesomeness of the JS date constructor. Month needs to be
+ * between 0-11, because things have to be difficult. */
+ var date = new Date(matches[1], matches[2] - 1, matches[3],
+ matches[4], matches[5], matches[7]);
+ return $.tablesorter.formatFloat(date.getTime());
},
type: 'numeric'
});