You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/sorting/date-uk.js

27 lines
753 B
JavaScript

/**
* DataTables internal date sorting replies on Date.parse() which is part of
* the Javascript language, but you may wish to sort on dates which is doesn't
* recognise. The following is a plug-in for sorting dates in the format
* dd/mm/yy.
*
* An automatic type detection plug-in is available for this sorting plug-in.
13 years ago
* @name Date (dd/mm/YY)
* @anchor date_uk
* @author Andy McMaster
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-uk-pre": function ( a ) {
var ukDatea = a.split('/');
return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
},
"date-uk-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-uk-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );