From fdbee7fdf670ac5d5497ea603e1b3ea03f3b572e Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Mon, 9 Mar 2015 11:39:59 +0000 Subject: [PATCH] Update - sorting: Add HTML stripping support to the moment plugin --- sorting/datetime-moment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorting/datetime-moment.js b/sorting/datetime-moment.js index 35af232..aae10d9 100644 --- a/sorting/datetime-moment.js +++ b/sorting/datetime-moment.js @@ -32,7 +32,7 @@ $.fn.dataTable.moment = function ( format, locale ) { return 'moment-'+format; } - return moment( d, format, locale, true ).isValid() ? + return moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).isValid() ? 'moment-'+format : null; } ); @@ -41,7 +41,7 @@ $.fn.dataTable.moment = function ( format, locale ) { types.order[ 'moment-'+format+'-pre' ] = function ( d ) { return d === '' || d === null ? -Infinity : - parseInt( moment( d, format, locale, true ).format( 'x' ), 10 ); + parseInt( moment( d.replace ? d.replace(/<.*?>/g, '') : d, format, locale, true ).format( 'x' ), 10 ); }; };