Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7933533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:21:46+00:00 2026-06-03T21:21:46+00:00

I recently had help getting the correct Date format on my jQuery / tablesorter

  • 0

I recently had help getting the correct Date format on my jQuery / tablesorter table. The client is listing companies in a table and wants one of the columns sortable by date, several of which are ‘Active ‘ companies in the portfolio, while others have exited and those are those ones that use the date format. The problem I have, is that because these are all in the same table, and the Date column is sorting by date, the companies that are listed as ‘Active’ get grouped together either at the beginning or end of the list but in reverse chronologial order.

So the companies are currently sorting like ‘active’ > ‘active’ > ‘active’ > Jan 2006 > Mar 2010 > Feb 2012, etc.

I would like to see if there is a way to add this into the parser so that the ‘Active’ string is converted into the current date, so that the companies are sorted like:
‘active’ > ‘active’ > ‘active’ > Feb 2012 > Mar 2010 > Jan 2006.

Is this possible? Any ideas? I decided to start a new thread on this because it is an new issue from the previous, which was just to get the correct Date format working. I am posting my HTML and code below. Thanks in advance.

<table id="myTable" class="tablesorter stripeMe sample" width="100%" cellpadding="0"  cellspacing="0">
<thead>
<th width="30%" align="left">COMPANY</th><th width="35%">DESCRIPTION</th><th width="17%"  align="left">INDUSTRY</th><th width="18%" align="left">EXIT DATE</th></tr></thead>
<tbody>
<tr><td width="30%">  Cartera Commerce, Inc. </td>
<td width="35%">Provides technology-enabled marketing and loyalty solutions 
</td><td width="17%">   Financials    </td> <td width="18%">Active</td>
</tr><tr><td width="30%">   Critical Information Network, LLC </td>
<td width="35%">Operates library of industrial professional training and certification materials 
</td><td width="17%">   Education    </td> <td width="18%">Active</td>
</tr><tr><td width="30%"> Cynergydata </td>
<td width="35%">Provides merchant payment processing services and related software products 
</td><td width="17%">   Merchant Processing    </td> <td width="18%">Active</td>
</tr><tr><td width="30%">    </td>
<td width="35%">Operates post-secondary schools  
</td><td width="17%">   Education    </td> <td width="18%">Active</td>
</tr><tr><td width="30%">  CorVu Corporation</td>
<td width="35%">Develops and distributes performance management software products and related services 
</td><td width="17%">   Information Technology    </td> <td width="18%">May 2007</td>
</tr><tr><td width="30%">    Fischer Imaging Corporation </td>
 <td width="35%">Manufactures and services specialty digital imaging systems and other  medical devices
</td><td width="17%">   Healthcare    </td> <td width="18%">Sep 2005</td>
</tr><tr><td width="30%">   Global Transportation Services, Inc.  </td>
<td width="35%">Provides air and ocean transportation and logistics services
</td><td width="17%">   Transportation     </td> <td width="18%">Mar 2010</td>
</tr><tr><td width="30%">  HMP/Rita  </td>
<td width="35%">Operates as a specialty medical device company that manufactures and markets vascular and spinal access systems
</td><td width="17%">   Healthcare    </td> <td width="18%">Dec 2006</td>
</tr>

</tbody>
</table>

And the current jQuery parser:

$.tablesorter.addParser({
id: 'monthYear',
is: function(s) {
    return false;
},
format: function(s) {
    var date = s.match(/^(\w{3})[ ](\d{4})$/);
    var m = date ? date[1] + ' 1 ' || '' : '';
    var y = date && date[2] ? date[2] || '' : '';
    return new Date(m + y).getTime() || '';
},
type: 'Numeric'
});

$('#myTable').tablesorter({

headers: {
    3: {
        sorter: 'monthYear'
    }
}

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:21:48+00:00Added an answer on June 3, 2026 at 9:21 pm

    It’s actually just a simple modification. Change the parser to this:

    var today = new Date().getTime();
    
    $.tablesorter.addParser({
        id: 'monthYear',
        is: function(s) {
            return false;
        },
        format: function(s) {
            // remove extra spacing
            s = $.trim(s.replace(/\s+/g, ' '));
            // process date
            var date = s.match(/^(\w{3})[ ](\d{4})$/),
                m = date ? date[1] + ' 1 ' || '' : '',
                y = date && date[2] ? date[2] || '' : '';
            return /active/i.test(s) ? today : new Date(m + y).getTime() || '';
        },
        type: 'Numeric'
    });
    

    The word “active” in the table cell will be case insensitive. And here is a demo of it working. Note that dates in the future, Jul 2012 in this case, will sort above “active”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using GAE for months now, but very recently I've had difficulty getting
I recently asked a question (and had it answered) here: jQuery Load JSON I
Recently, one of our clients has deleted two million rows from a table. Here
I recently had to update one of my model's properties from type StringProperty to
Wonder if anyone can help. I recently had an issue with UTF8 in the
Help. I recently purchased a new PC. I had my eclipse set up and
I've recently had to dust off my Perl and shell script skills to help
I recently had a discussion with a colleague about serialization of byte data over
I recently had an idea to create my own String class to make using
I recently had the task of adding a barcode onto a SSRS report without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.