Sorting does not work properly on columns with empty dates inside

HTML tags.
pull/246/head
Wesley Ribeiro 9 years ago
parent 6bedd3b616
commit 9e7942b821

@ -50,9 +50,12 @@ $.fn.dataTable.moment = function ( format, locale ) {
// Add sorting method - use an integer for the sorting // Add sorting method - use an integer for the sorting
types.order[ 'moment-'+format+'-pre' ] = function ( d ) { types.order[ 'moment-'+format+'-pre' ] = function ( d ) {
if ( d && d.replace ) {
d = d.replace(/<.*?>/g, '');
}
return d === '' || d === null ? return d === '' || d === null ?
-Infinity : -Infinity :
parseInt( moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).format( 'x' ), 10 ); parseInt( moment( d, format, locale, true ).format( 'x' ), 10 );
}; };
}; };

Loading…
Cancel
Save