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-euro.js

33 lines
1.0 KiB
JavaScript

/**
* This plug-in will provide date sorting for the "dd/mm/YYY hh:ii:ss"
* formatting, which is common in France and other European countries. It can
* also be quickly adapted for other formatting as required. Furthermore, this
* date sorting plug-in allows for empty values in the column.
* @name Date (dd/mm/YYY hh:ii:ss)
13 years ago
* @anchor date_euro
* @author <a href="http://coolforest.net/">Ronan Guilloux</a>
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-euro-pre": function ( a ) {
if ($.trim(a) != '') {
var frDatea = $.trim(a).split(' ');
var frTimea = frDatea[1].split(':');
var frDatea2 = frDatea[0].split('/');
var x = (frDatea2[2] + frDatea2[1] + frDatea2[0] + frTimea[0] + frTimea[1] + frTimea[2]) * 1;
} else {
var x = 10000000000000; // = l'an 1000 ...
}
return x;
},
"date-euro-asc": function ( a, b ) {
return a - b;
},
"date-euro-desc": function ( a, b ) {
return b - a;
}
} );