Page MenuHomePhabricator

Add support for the ordinal indicator º in jquery.tablesorter for dates in Italian
Closed, ResolvedPublic

Description

In Italian dates, only the first day of the month may be written as 1º or 1°, and it's more common than just 1.
But it doesn't work in sortable tables. In example below, on it.wiki, all days are sorted correctly except 1.
The sorting code should simply discard those symbols when reading Italian dates.

{| class=sortable
! data-sort-type=date | Date
|-
| 2 maggio 1999
|-
| 3 maggio 1999
|-
| 1º maggio 1999
|-
| 4 maggio 1999
|-
| 5 maggio 1999
|}

Other languages may have similar problems, for example I think en.wiki can't sort dates with "1st" etc.

Event Timeline

please reopen, as this is not a duplicate. The other task is wrong, as I explained there. Generally "date" does handle localized date formats; here I am pointing out only a specific bug in handling of Italian.

Sakretsu renamed this task from Date columns in sortable tables (Italian) to Add support for the ordinal indicator º in jquery.tablesorter for dates in Italian.Nov 3 2022, 11:16 AM

Looks like an easy fix? I think we just need to add the ordinal indicator to this regex so that it matches and we're good to go. @TheDJ @matmarex can either of you take a quick look at this please?

Sounds okay to me, I'll merge it if you submit a patch.

Change 856977 had a related patch set uploaded (by Sakretsu; author: Sakretsu):

[mediawiki/core@master] jquery.tablesorter: Add support for the ordinal indicator º in dates

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

Change 856977 merged by jenkins-bot:

[mediawiki/core@master] jquery.tablesorter: Add support for the ordinal indicator º in dates

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

matmarex assigned this task to Sakretsu.

Thanks!

The change will be deployed to Wikimedia wikis per the usual schedule. (Note that the regular deployments next week are cancelled, so this will happen in the week of 29 November – 1 December.)

Krinkle subscribed.

@Sakretsu Would you mind adding a test case as well? This might get lost otherwise in future refactors.

See https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing for how to run tests locally in case you haven't done that before. If you use the default docker-based dev env, all you do is head to /wiki/Special:JavaScriptTest locally and in the test editor look for jquery.tablesorter.test.js.

Change 861870 had a related patch set uploaded (by Sakretsu; author: Sakretsu):

[mediawiki/core@master] jquery.tablesorter: Add test case for dates with the ordinal indicator º

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

Change 861870 merged by jenkins-bot:

[mediawiki/core@master] jquery.tablesorter: Add test case for dates with the ordinal indicator º

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