The first problem is you didn't configure the datetime-moment.js plugin ($.fn.dataTable.moment( ... );) as shown in the example.
return "Invalid date"
You don't need to use columns.render to return the date format. As you mention it is already DD/MM/YYYY. However the moment() method needs to knwo the source format, for example: moment(data, 'DD/MM/YYYY').format('DD/MM/YYYY');. I changed your example with this and you can see it if you uncomment the render option.
Replies
Can you post a link to your page or a test case so we can see the data and the problem?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
HERE
Is it the Date column thats not sorting correctly?
If so use the Datatables recommended sorting solution documented here.
Kevin
return "Invalid date"
but my date is already ITALIAN format "DD / MM / YYYY"
HERE
help me please. do you have example ??
The first problem is you didn't configure the datetime-moment.js plugin (
$.fn.dataTable.moment( ... );
) as shown in the example.You don't need to use
columns.render
to return the date format. As you mention it is alreadyDD/MM/YYYY
. However the moment() method needs to knwo the source format, for example:moment(data, 'DD/MM/YYYY').format('DD/MM/YYYY');
. I changed your example with this and you can see it if you uncomment the render option.http://live.datatables.net/kikuranu/1/edit
Kevin