How do I load and/or download "/sorting/datetime-moment.js"?
How do I load and/or download "/sorting/datetime-moment.js"?
Hi.
I've been using datatables for years and would like to get the moment.js option working for sorting.
I've downloaded the latest build of datatables and also the moment.min.js file.
I have these loaded on my page (in the correct order) :-
jquery-3.5.1.min.js
moment.min.js
DataTables-1.11.5/js/jquery.dataTables.min.js
DateTime-1.1.2/js/dataTables.dateTime.min.js (is this the correct file to include????).
Within the code, before creating the datatables, I do :-
$.fn.dataTable.moment( 'DD/MM/YYYY' );
$.fn.dataTable.moment( 'DD/MM/YY' );
But I get error message :-
Uncaught TypeError: $.fn.dataTable.moment is not a function.
I've tried to work out what else I need to download.
I've looked at the Plug-Ins section, but I don't understand how to download these (I'm obviously missing something).
Any help would be much appreciated.
Answers
I've found the CDN link now to download the datetime-moment.js file and it works.
Just an observation, but finding the CDN downloads took quite some time, I went to the Plug-Ins page, but there's no link there to the CDN without going through several pages (Download -> DataTables CDN -> Latest plug-ins).
Hi Keith,
Good to hear you found it. The CDN hosted address is available on the plug-in's page.
Allan