# tablesorter

## Assorted date parsers

### Flexible client-side table sorting

Back to documentation

NOTE!

- In v2.24.1,
  - Updated weekday & month parsers to better integrate with jQuery Globalize.
  - This demo now includes a column for French named weekdays & months.
- Parse Dates with these parsers
  - The "Date" column is using the sugar library to parse dates. Make sure to include the sugar library and the sugar-date-parser.
  - The "Weekday" column uses the included "weekday" parser. You can modify parser to match whatever language you are using.
  - The "Month" column uses the included "month" parser. You can also modify the month names within the parser to match whatever language you are using.
  - The "Year" column is just using the included two digit year parser:
    - Formats for "mmddyy", "ddmmyy" and "yymmdd" are available
    - Within the parser code is a `range` variable which is set to `50` years range, which sets the date be within +/- range of the listed two digit year.
    - So if the current year is `2020`, and the listed two digit year is `80` (`2080 - 2020 > 50`), it becomes `1980`.
    - If the listed two digit year is `50` (`2050 - 2020 < 50`), then it becomes `2050`. I hope that makes it clearer.
    - Try out the two digit year calculator below the table.
    - In v2.14.0, the range can be set using the `dateRange` option (see the initialization code below).
  - The "Time" column is using the built-in time parser which has been always been included with tablesorter .

# Demo

Date | Weekday | Weekday (French) | Month | Month (French) | MM/DD/YY | Time
--- | --- | --- | --- | --- | --- | ---
next friday | Friday | Vendredi | Aug | Août | 02/1/16 | 12:00 PM
today | Sunday | Dim | September | Septembre | 1/2/16 | 00:00
last Tuesday | Fri | Ven | Mar | Mars | 11/1/15 | 18:00
the day after tomorrow | Wed | Mer | July | Juillet | 01/1/16 | 13:00
2010-05-25T12:30:40.299+01:00 | Monday | Lun | Jan | Janvier | 1/11/15 | 1:30 PM
May 25th of next year | Tues | Mardi | Nov | Novembre | 1/1/15 | 14:00
25 May 2010 | Tuesday | Mar | November | Nov | 3/1/15 | 1:58 PM
the last day of March | Sat | Sam | December | Décembre | 1/15/15 | 2:10 PM
last month | Wednesday | Mercredi | April | Avr | 11/11/16 | 13:50
one day before yesterday | Thursday | Jeudi | Feb | Février | 5/1/15 | 4:00 AM

### Two digit year calculator:

two digit year becomes 2020
( range "current year" )

# Page Header

    <!-- blue theme stylesheet with additional css styles added in v2.0.17 -->
    <link rel="stylesheet" href="../css/theme.blue.css">
    <!-- tablesorter plugin -->
    <script src="../js/jquery.tablesorter.js"></script>

    <!-- load month, weekday and two digit year parsers -->
    <script src="../js/parsers/parser-date-month.js"></script>
    <script src="../js/parsers/parser-date-weekday.js"></script>
    <script src="../js/parsers/parser-date-two-digit-year.js"></script>

    <!-- https://sugarjs.com/docs/#/DateParsing -->
    <script src="../js/sugar.js"></script>
    <script src="../js/parsers/parser-date-sugar.js"></script>

# Javascript

# HTML

Next up: Applying the filter widget ››