I have a date search engine in dataTables that due to format problems I used the moment.js library and everything worked perfectly, but when I wanted to save those searches in session so that the inputs do not lose the values I started to fail, but not quite.
The fact is that I have a view with two tables next to each other, and I have a date range search engine, if I only use it in one, it works perfectly for me, now at the time I reload the page after searching in both at the time of recharging I get the following error:
Deprecation warning: value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 0.00, _f: undefined, _strict: undefined, _locale: [object Object]
Error
at Function.createFromInputFallback (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:20:668)
at eb (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:132:129)
at pb (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:172:413)
at ob (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:172:274)
at nb (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:170:503)
at qb (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:177:164)
at rb (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:177:198)
at q.Zb [as isSame] (https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.0/moment.min.js:233:774)
at Array.<anonymous> (http://project.local/tables:87290:55)
at yb (https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js:43:117)
Both inputs, session variables are different for each table, so it should work if they work separately and with separate functions.
Has anyone ever encountered this error? I have looked at the official documentation but it does not give much light about it.
EDIT:
I have found a way to parameterize the function that makes me fail the moment.js or that I think. But of course when setting the settings.nTable.id to know which table to filter, I get an error Uncaught ReferenceError: settings is not defined
Here I leave the example that I have found on the official website of DataTables
$.fn.dataTableExt.afnFiltering.push(
function( settings, aData, iDataIndex ) {
if ( settings.nTable.id === 'example' ) {
// filter example
} else {
// ...
}
}
);
Looking in the documentation and everywhere I have not found anything referring to how it says settings someone would know something about this functionality?