From c1104c2dbdc16bda730c79c9bdd1c8f48b2f733f Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Sat, 23 Mar 2013 22:29:51 +0100 Subject: [PATCH] (bug 42607) $.tablesorter: require separators when detecting dates $.tablesorter allowed no separators in DMY- or MDY-formatted dates, where M is a month taken from the wgMonthNames and wgMonthNamesShort variables. This was probably intended to capture dates like '1Dec2012'. Unfortunately, for example the Czech language uses no short month names, and the variable simply contains numbers from 1 to 12. This caused the datection to break horribly and consider all numbers to be dates. With this patch, detection requires a space or one of the other defined separators between month and day or year. Change-Id: I3a37acf1985eddf922e69e2c2a1cf541fc00e97e --- resources/jquery/jquery.tablesorter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index e08c9aafb4..a552237d3a 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -424,10 +424,10 @@ ts.dateRegex[0] = new RegExp( /^\s*(\d{1,2})[\,\.\-\/'\s]{1,2}(\d{1,2})[\,\.\-\/'\s]{1,2}(\d{2,4})\s*?/i); // Written Month name, dmy - ts.dateRegex[1] = new RegExp( '^\\s*(\\d{1,2})[\\,\\.\\-\\/\'\\s]*(' + regex + ')' + '[\\,\\.\\-\\/\'\\s]*(\\d{2,4})\\s*$', 'i' ); + ts.dateRegex[1] = new RegExp( '^\\s*(\\d{1,2})[\\,\\.\\-\\/\'\\s]+(' + regex + ')' + '[\\,\\.\\-\\/\'\\s]+(\\d{2,4})\\s*$', 'i' ); // Written Month name, mdy - ts.dateRegex[2] = new RegExp( '^\\s*(' + regex + ')' + '[\\,\\.\\-\\/\'\\s]*(\\d{1,2})[\\,\\.\\-\\/\'\\s]*(\\d{2,4})\\s*$', 'i' ); + ts.dateRegex[2] = new RegExp( '^\\s*(' + regex + ')' + '[\\,\\.\\-\\/\'\\s]+(\\d{1,2})[\\,\\.\\-\\/\'\\s]+(\\d{2,4})\\s*$', 'i' ); } -- 2.20.1