From cd5597db4b78f7116819f41faadce6224656caab Mon Sep 17 00:00:00 2001 From: Lode Claassen Date: Sun, 23 Oct 2016 10:54:50 +0200 Subject: [PATCH] fix firefox not sorting when format contains spaces or colons --- sorting/datetime-moment.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorting/datetime-moment.js b/sorting/datetime-moment.js index c9cdded6..972bc0b5 100644 --- a/sorting/datetime-moment.js +++ b/sorting/datetime-moment.js @@ -54,7 +54,8 @@ $.fn.dataTable.moment = function ( format, locale ) { } ); // Add sorting method - use an integer for the sorting - types.order[ 'moment-'+format+'-pre' ] = function ( d ) { + var formatKey = format.replace(/[^a-zA-Z0-9-]/g, '-'); + types.order[ 'moment-'+formatKey+'-pre' ] = function ( d ) { if ( d ) { // Strip HTML tags and newline characters if possible if ( d.replace ) {