In my project I want to sort date which is in dd-mm-yyyy format. I tried like this below
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));
}
});
But this is not working. Here only date and month is getting sorted not also on the basis of year. I took reference from here Datatable date sorting dd/mm/yyyy issue