Page MenuHomePhabricator

[Regression] Tablesorter broken for abbreviated months
Closed, ResolvedPublic

Description

The script for sortable tables is broken if a date contains an abbreviated month, see the example (tested on de.wikipedia)

{|class="wikitable sortable"
! data-sort-type="date" | date1 !! data-sort-type="date" | date2

-
1. Jan.20121. Jan. 2012
-
1. Apr.20111. Apr. 2011
}

The first column sorts randomly, only the second one is correct. I tracked this down to

jQuery.tablesorter.dateRegex[1]

< /^\s*(\d{1,2})[\,\.\-\/'\s]+(januar|januars|jan\.|februar|februars|feb\.|märz|märzes|mär\.|april|aprils|apr\.|mai|mais|mai|juni|junis|jun\.|juli|julis|jul\.|august|augusts|aug\.|september|septembers|sep\.|oktober|oktobers|okt\.|november|novembers|nov\.|dezember|dezembers|dez\.)[\,\.\-\/'\s]+(\d{2,4})\s*$/i

Note the \. after the abbreviations, which shouldn't be there (otherwise the expected separator to the year is missing).

https://git.wikimedia.org/blob/mediawiki%2Fcore.git/5bf45af50e6049ded2915f360fb1ed914f839286/resources%2Fjquery%2Fjquery.tablesorter.js#L484

is supposed to remove it, but it does so for the wrong month forms, namely for the genitives instead of the abbrevs.


Version: 1.22.0
Severity: normal

Details

Reference
bz56038

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:26 AM
bzimport set Reference to bz56038.
Schnark created this task.Oct 23 2013, 9:23 AM

Whooooops. It seems like I broke it in If758499f when adding support for genitive-form month names. Sorry about that, I'll submit a patch in a minute.

Change 91363 had a related patch set uploaded by Bartosz Dziewoński:
tablesorter: Unbreak abbreviated month name support

https://gerrit.wikimedia.org/r/91363

Change 91363 merged by jenkins-bot:
tablesorter: Unbreak abbreviated month name support

https://gerrit.wikimedia.org/r/91363

Fixed and merged. Thank you for the report!

It will be deployed to Wikipedias on 31 October
per [[mw:MediaWiki 1.23/Roadmap]] (I think, we're
releasing 1.23 and I'm not quite sure which version
is which now).