Sort With Moment
Sort With Moment

i try to sort date with moment in datatable, but its seem that the order function order not by the value
here my code:
"columns": [
{ "data": "OrderId", "name": "OrderId" },
{ "data": "CustomerId", "name": "CustomerId", "orderable": false },
{ "data": "RefundType", "name": "RefundType", "autoWidth": true },
{ "data": "RefundReason", "name": "RefundReason", "autoWidth": true },
{ "data": "PaymentType", "name": "PaymentType", "autoWidth": true },
{
"data": "RefundDate", "name": "RefundDate", "autoWidth": true,
render: function (data, type, row) {
return type == 'display' ? moment(data, "MMM DD YYYY HH: ssa").format('DD/MM/YYYY') : data
}
},
{ "data": "RefundValue", "name": "RefundValue", "autoWidth": true },
],
"order": [[5, "desc"]],
});
HERE MY RESULT:
how can i fix it?
the format i get form server is:
This discussion has been closed.
Answers
The recommended solution for datetime sorting is discussed in this blog.
Kevin