Update - sorting: Add HTML stripping support to the moment plugin

pull/172/head
Allan Jardine 10 years ago
parent 22fd8b0967
commit fdbee7fdf6

@ -32,7 +32,7 @@ $.fn.dataTable.moment = function ( format, locale ) {
return 'moment-'+format; return 'moment-'+format;
} }
return moment( d, format, locale, true ).isValid() ? return moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).isValid() ?
'moment-'+format : 'moment-'+format :
null; null;
} ); } );
@ -41,7 +41,7 @@ $.fn.dataTable.moment = function ( format, locale ) {
types.order[ 'moment-'+format+'-pre' ] = function ( d ) { types.order[ 'moment-'+format+'-pre' ] = function ( d ) {
return d === '' || d === null ? return d === '' || d === null ?
-Infinity : -Infinity :
parseInt( moment( d, format, locale, true ).format( 'x' ), 10 ); parseInt( moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).format( 'x' ), 10 );
}; };
}; };

Loading…
Cancel
Save