[jQuery] Tablesorter Date Parser: FF Fine, IE Not Fine
In my table, I have a column with dates that are formatted as "Month Year,"
i.e. "August 2008."
I have this parser:
ts.addParser({
id: "monthyear",
is: function(s) {
return false;
},
format: function(s) {
var a = s.split(' ');
a[0] = this.getMonth(a[0]);
return $.tablesorter.formatFloat(new Date(a.join(" 1, ")).getTime());
},
getMonth: function(s) {
var m =
['January','February','March','April','May','June','July','August','September','October','November','December'];
var n = m.length;
for(var i=0; i < n; i++) {
if(m[i] == s) {
return (i+1);
}
}
},
type: "numeric"
});
It's supposed to pick up the text from the cell, split it via the space,
plug in ' 1, ' between the month and year and return the ticks based on that
date. I don't get what doesn't work [in IE].
This parser was adapted from another I found here on the forums. I've turned
on debug and the script is picking up on it, but it seems to just ignore it.
I've changed the sorter to 'text' and 'numeric', both of which sort the
dates alphabetically. The other date parsers don't sort at all (which is
understandable).
This parser works in FF, but not in IE. Can anybody tell why?
--
View this message in context: http://www.nabble.com/Tablesorter-Date-Parser%3A-FF-Fine%2C-IE-Not-Fine-tp18820239s27240p18820239.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.