jQuery tablesorter parser for datetime in MM.DD.YYYY HH:MI AM format
<p>I am having a 4 column table in which the 2nd column is a date column with the following format "mm.dd.yyyy hh:mi am". The default tablesorter doesn't sort by date column correctly. I had to write my own parser in tablesorter but it is still not working for me. I am not sure if the regex used is correct or not and if anyone can point me the mistake in the code below? I would appreciate your help.</p>

<pre><code>ts.addParser(
{
    id: "srsDate",
    is: function (s) {
        return /\d{1,2}\.\d{1,2}\.\d{1,4} \d{1,2}:\d{1,2}\s(am|pm)/.test(s);
    },
    format: function (s) {
        s = s.replace(/\./g, " ");
        s = s.replace(/\:/g, " ");
        s = s.replace("am", "0");
        s = s.replace("pm", "1");
        s = s.split(" ");
        return $.tablesorter.formatFloat(new Date(s[0], s[1], s[2], s[3], s[4], s[5]).getTime() + parseInt(s[6]));
    },
    type: "numeric" 
});
</code></pre>

<p>And I call it like:</p>

<pre><code>myapp.Sort = function () {
    $(myapp.config.tblHistory).tablesorter({ headers: { 1: { sorter: 'srsDate'} }, sortList: [[0, 0]] });
}
</code></pre>

<p>I referenced: <a href="http://stackoverflow.com/questions/1707840/date-sorting-problem-with-jquery-tablesorter">date Sorting Problem with Jquery Tablesorter</a> to build the new parser. The results of the sort is not working. It doesn't sort the data at all.</p>
