How to use the Ultimate date/time sorting plugin

How to use the Ultimate date/time sorting plugin

snaveevanssnaveevans Posts: 2Questions: 1Answers: 0

I'm trying to get the ultimate date/time sorting plugin to work however I don't know what is going wrong but it is not working.
I've been following this https://datatables.net/blog/2014-12-18

I've done the following:

  • Added moment.js to my page
  • Added datetime-moment.js to my page
  • Verified they are being loaded
  • Debugged in Chrome the function $.fn.dataTable.moment() is being called with the format given
  • Initialized the plugin using $.fn.dataTable.moment('MM/DD/YYYY');
  • Initialized datatables using the following:
$('.intlTable').DataTable({
        lengthMenu: [[10, 25, 50], [10, 25, 50]],
        dom: 'lBfrtip',
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdfHtml5',
        ]
    });

Everything works (page length, switching pages, export buttons) just fine except sorting dates.

What am I missing to get this to work? Any help would be greatly appreciated, thank you!

Answers

  • snaveevanssnaveevans Posts: 2Questions: 1Answers: 0

    Check my formats again, and found I was wrong, it needed to be $.fn.dataTable.moment('M/D/YYYY');

This discussion has been closed.