2015-11-02 05:44:14 +00:00
|
|
|
/*! Parser: Month - updated 11/2/2015 (v2.24.1) */
|
2015-03-28 20:03:50 +00:00
|
|
|
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
2013-03-26 21:05:21 +00:00
|
|
|
/*jshint jquery:true */
|
|
|
|
;(function($){
|
2015-07-23 04:29:51 +00:00
|
|
|
'use strict';
|
2013-03-26 21:05:21 +00:00
|
|
|
|
2013-09-29 19:37:03 +00:00
|
|
|
var ts = $.tablesorter;
|
2015-11-02 05:44:14 +00:00
|
|
|
ts.dates = $.extend( {}, {
|
|
|
|
// See http://mottie.github.io/tablesorter/docs/example-widget-grouping.html
|
|
|
|
// for details on how to use CLDR data for a locale to add data for this parser
|
|
|
|
// CLDR returns an object { 1: "Jan", 2: "Feb", 3: "Mar", ..., 12: "Dec" }
|
|
|
|
months : {
|
|
|
|
'en' : {
|
|
|
|
1 : 'Jan',
|
|
|
|
2 : 'Feb',
|
|
|
|
3 : 'Mar',
|
|
|
|
4 : 'Apr',
|
|
|
|
5 : 'May',
|
|
|
|
6 : 'Jun',
|
|
|
|
7 : 'Jul',
|
|
|
|
8 : 'Aug',
|
|
|
|
9 : 'Sep',
|
|
|
|
10: 'Oct',
|
|
|
|
11: 'Nov',
|
|
|
|
12: 'Dec'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, ts.dates );
|
2013-03-26 21:05:21 +00:00
|
|
|
|
2013-09-29 19:37:03 +00:00
|
|
|
ts.addParser({
|
2015-07-23 04:29:51 +00:00
|
|
|
id: 'month',
|
2015-11-02 05:44:14 +00:00
|
|
|
is: function() {
|
2013-03-26 21:05:21 +00:00
|
|
|
return false;
|
|
|
|
},
|
2015-11-02 05:44:14 +00:00
|
|
|
format: function( str, table, cell, cellIndex ) {
|
|
|
|
if ( str ) {
|
|
|
|
var m, month,
|
|
|
|
c = table.config,
|
|
|
|
// add options to 'config.globalize' for all columns --> globalize : { lang: 'en' }
|
|
|
|
// or per column by using the column index --> globalize : { 0 : { lang: 'fr' } }
|
|
|
|
options = c.globalize && ( c.globalize[ cellIndex ] || c.globalize ) || {},
|
|
|
|
months = ts.dates.months[ options.lang || 'en' ];
|
|
|
|
if ( c.ignoreCase ) {
|
|
|
|
str = str.toLowerCase();
|
|
|
|
}
|
|
|
|
for ( month in months ) {
|
|
|
|
if ( typeof month === 'string' ) {
|
|
|
|
m = months[ month ];
|
|
|
|
if ( c.ignoreCase ) {
|
|
|
|
m = m.toLowerCase();
|
|
|
|
}
|
|
|
|
if ( str.match( m ) ) {
|
|
|
|
return parseInt( month, 10 );
|
|
|
|
}
|
2014-09-30 21:20:04 +00:00
|
|
|
}
|
2015-11-02 05:44:14 +00:00
|
|
|
}
|
2014-09-30 21:20:04 +00:00
|
|
|
}
|
2015-11-02 05:44:14 +00:00
|
|
|
return str;
|
2013-03-26 21:05:21 +00:00
|
|
|
},
|
2015-07-23 04:29:51 +00:00
|
|
|
type: 'numeric'
|
2013-03-26 21:05:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
})(jQuery);
|