I've been trying to get this parser I've customized to work, but I'm not sure
about the syntax... would this be easier to help me with/is this on the
right track?

ts.addParser({
                id: "shortDate",
                is: function(s) {
                        return /\d{2,}[\s]\w{4,}[\s]\d{4,}/.test(s);
                },
                format: function(s,table) {
                        var c = table.config;
                        s = s.replace(/\-/g," ");
                        if(c.dateFormat == "us") {
                                // reformat the string in ISO format
                                s = 
s.replace(/(\d{2,})[\s](\w{4,})[\s](\d{4,})/, "$3/$1/$2");
                        } else if(c.dateFormat == "uk") {
                                //reformat the string in ISO format
                                s = 
s.replace(/(\d{2,0})[\s](\w{4,})[\s](\d{4,})/, "$3/$2/$1");
                        } else if(c.dateFormat == "dd/mm/yy" || c.dateFormat == 
"dd-mm-yy") {
                                s = 
s.replace(/(\d{2,0})[\s](\w{4,})[\s](\d{4,})/, "$1/$2/$3"); 
                        }
                        return $.tablesorter.formatFloat(new Date(s).getTime());
                },
                type: "numeric"
        });


-- 
View this message in context: 
http://old.nabble.com/tablesorter-help---sort-by-date-wont-work%21-tp26286016s27240p26287153.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to