Sorting: Update moment date / time to strip HTML tags before checking for empty

- Update suggested by sporring - thanks!
pull/227/head
Allan Jardine 9 years ago
parent ae1d5043d2
commit 0f8ec6f7de

@ -27,12 +27,17 @@ $.fn.dataTable.moment = function ( format, locale ) {
// Add type detection
types.detect.unshift( function ( d ) {
// Strip HTML tags if possible
if ( d && d.replace ) {
d = d.replace(/<.*?>/g, '') ) {
}
// Null and empty values are acceptable
if ( d === '' || d === null ) {
return 'moment-'+format;
}
return moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).isValid() ?
return moment( d, format, locale, true ).isValid() ?
'moment-'+format :
null;
} );

Loading…
Cancel
Save