From: MatmaRex Date: Sat, 23 Mar 2013 21:29:51 +0000 (+0100) Subject: (bug 42607) $.tablesorter: require separators when detecting dates X-Git-Tag: 1.31.0-rc.0~20001^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/modifier.php?a=commitdiff_plain;h=c1104c2dbdc16bda730c79c9bdd1c8f48b2f733f;p=lhc%2Fweb%2Fwiklou.git (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 --- 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' ); }