How to fix sorting for Date format dd-mm-yyyy?
How to fix sorting for Date format dd-mm-yyyy?
I have datatables that contain of multiple column of date. But all the column date is not work perfectly for sorting asc and desc.
For instance:

This is my Datatable for image above, just to inform that I have a function to display date only with dd-mm-yyyy format.
$('#projectListTable').DataTable({
    columns: [
        { data : "planned_date",
            render: function(data){
                if (data == null){
                    return data;
                }
                else {
                    new_data = data.split("T");
                    new_data[0] = displayDate(new_data[0]);
                    return new_data[0];
                }
            }
        },
        { data : "planned_finish",
            render: function(data){
                if (data == null){
                    return data;
                }
                else {
                    new_data = data.split("T");
                    new_data[0] = displayDate(new_data[0]);
                    return new_data[0];
                }
            }
        }
    ],
});
                This discussion has been closed.
            
Answers
There are many posts in here about date sorting. For example:
https://datatables.net/forums/discussion/53126
yes I read it, but do not know which is better and suit with my problem.
I found this solution, but how to combine with mine? Please guide by answering with proper code. I am blurring.
Where is
type: 'extract-datecome from? and what does mean bytargets: [0]?https://datatables.net/forums/discussion/41076/how-to-sort-table-by-dd-mm-yyyy
extract-dateis the type, you see it declared at the top, then used on line 20. And seecolumnDefs.targets- it's the column number.Colin