diff --git a/.datatables-commit-sync b/.datatables-commit-sync index 0ff8db41..0e77545a 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -23e7a8a3c3e386567adf2ea3a4e454a4ca7ff2f1 +1f4688ea66aa148745212b66562aa3508ee15b98 diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 8d41b2a5..9e3dc41d 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -104,6 +104,7 @@ var _re_new_lines = /[\r\n]/g; var _re_html = /<.*?>/g; var _re_formatted_numeric = /[',$£€¥%]/g; + var _re_date_start = /^[\d\+\-a-zA-Z]/; @@ -2520,11 +2521,12 @@ var tableId = settings.sTableId; var previousSearch = settings.oPreviousSearch; var features = settings.aanFeatures; + var input = ''; var str = settings.oLanguage.sSearch; str = str.match(/_INPUT_/) ? - str.replace('_INPUT_', '') : - str+''; + str.replace('_INPUT_', input) : + str+input; var filter = $('
', { 'id': ! features.f ? tableId+'_filter' : null, @@ -13691,19 +13693,26 @@ // Built in type detection. See model.ext.aTypes for information about // what is required from this methods. $.extend( DataTable.ext.type.detect, [ - // Dates (only those recognised by the browser's Date.parse) - function ( d ) - { - var parsed = Date.parse(d); - return (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null; - }, - - // Plain numbers + // Plain numbers - first since V8 detects some plain numbers as dates + // e.g. Date.parse('55') (but not all, e.g. Date.parse('22')...). function ( d ) { return _isNumber( d ) ? 'numeric' : null; }, + // Dates (only those recognised by the browser's Date.parse) + function ( d ) + { + // V8 will remove any unknown characters at the start of the expression, + // leading to false matches such as `$245.12` being a valid date. See + // forum thread 18941 for detail. + if ( d && ! _re_date_start.test(d) ) { + return null; + } + var parsed = Date.parse(d); + return (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null; + }, + // Formatted numbers function ( d ) {