Sha256: fb5ee6926937a84e5f44d236ce2db71c77ea1d9178e184f3bd16c07096132a9c

Contents?: true

Size: 1.52 KB

Versions: 45

Compression:

Stored size: 1.52 KB

Contents

/*! Parser: Month - updated 11/22/2015 (v2.24.6) */
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
/*jshint jquery:true */
;(function($){
	'use strict';

	var ts = $.tablesorter;

	if ( !ts.dates ) { ts.dates = {}; }
	if ( !ts.dates.months ) { ts.dates.months = {}; }
	ts.dates.months.en = {
		// 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" }
		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.addParser({
		id: 'month',
		is: function() {
			return false;
		},
		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 );
						}
					}
				}
			}
			return str;
		},
		type: 'numeric'
	});

})(jQuery);

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
jquery-tablesorter-1.24.5 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.24.4 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.24.3 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.24.2 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.24.1 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.24.0 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.15 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.14 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.13 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.12 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.11 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.10 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.9 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.8 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.7 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.6 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.5 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.4 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.3 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js
jquery-tablesorter-1.23.2 vendor/assets/javascripts/jquery-tablesorter/parsers/parser-date-month.js