My page has a table that should initialize with the record create date in descending fashion. This was implemented the last quarter of 2017 but today I see that 01/02/2018 is being sorted as older than the December 2017 dates (attached screenshot). It is an Intranet site so I cannot offer a link to it.
I am using the plug in that should enable the sort [line 6 below in the code snippet])
$.ajax(
{
data: { startDt: $('#startDt').val(), endDt: $('#endDt').val() },
datatype: 'json',
success: function (rosterData) {
$.fn.dataTable.moment('MM/DD/YYYY','en-US');
$('#tblRoster').DataTable({
data: JSON.parse(rosterData.firstChild.textContent),
The column that is being sorted has the following configuration:
columns: [
{
'data': 'CreatedDt' ,
"type": "date ",
"render": function (value) {
if (value === null) return "";
return window.moment(value).format('MM/DD/YYYY');
}
},
A snippet of the JSON being used as data for the table is also attached. Thanks for any insight as to why it seems to be sorting more in string than date fashion.