Page MenuHomePhabricator

Sortable table date sorting
Closed, ResolvedPublic


Author: rmhermen

This is known but I don't see it listed as a bug needing fixing. The new sortable table
will sort dates but only if the dates are in the uncommon YYYY-MM-DD format and the
user's preference is also set to display dates that date format.

This should be made sortable for any of the supported date formats and for any
combination of supported date input formats and display formats. discusses issue with a hack to get
around it.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:28 PM
bzimport set Reference to bz8226.
bzimport added a subscriber: Unknown Object (MLST).

ayg wrote:

*** Bug 10322 has been marked as a duplicate of this bug. ***

Patch for wikibits.js to support sorting more date formats

Here's a patch against HEAD (r30348). Adds support for the four types of dates shown in preferences. Also makes a couple other changes. Tested in IE6/FF2 with this test data:

{|class="wikitable sortable"


!Date sort

07 Apr 2007
16 Apr 2007
01 01 2007
03:01, July 07, 2008
03:01, 06 July 2008
03:01, 05 March 2008
02:59, 2008 February 05
02:59, 2007 February 05
02:59, 2008 March 05

attachment wikibits.js.diff ignored as obsolete

And what if the language is not English?

Patch for wikibits.js to support sorting more date formats

Okay, I added support for other languages.

I added a global JavaScript variable called ts_month_map. In your wiki, you can do something like ts_month_map["Word for Jan in some other language"] = "01"; in your site-wide JavaScript. It doesn't work on multilingual wikis like commons.

I also added support for some other date formats. It should support

  • DD-[Jan|January]-YYYY
  • YYYY-[Jan|January]-DD
  • YYYY, DD [Jan|January]
  • [Jan|January] DD, YYYY
  • MM-DD-YY
  • hh:ss, January DD, YYYY
  • hh:ss, DD January YYYY
  • hh:ss, YYYY January DD
  • YYYY-MM-DDTHH:mm:ss


jon.1234 wrote:

  1. Can I apply this patch to the js file which came with mediawiki 1.13.2?
  1. (Sorry but) how can I apply the patch & do you have a full file so I can just swap them?

Many thanks ~~~~

bluehairedlawyer wrote:

I'm not sure if we should really support all of these date/time formats. I certainly like to argue that we definitely shouldn't support numeric formats such as


or worse


The only place people use 12.31.2008 is in the US and on enwiki we use both US and European formats. Using these ambiguous date should be strongly discourages and certainly not supported by the sorting script.

Supporting 31.12.67 should be punishable by summary execution!! Same problems as before and y2k bug anyone! Not to mention the y2050 bug. For an encyclopedia which tries to have articles written with historical perspective 31.12.67 or 12.31.67 should be a definite no no.

Sometimes less is more. We should just focus on 4 formats commonly used on enwiki:

1 January 2009
January 1, 2009 (with and without the comma)
1 Jan 2009 (also 01-Jan-2009)

and leave the rest out to wither and die.

bluehairedlawyer wrote:

On second thoughts I guess 01.12.2008 could be quite safely used outside enwiki.

bluehairedlawyer wrote:

*** Bug 15401 has been marked as a duplicate of this bug. ***

Related bug 15408 and bug 20418.

yonidebest wrote:

Please also add sorting support for dating in Hebrew for the Hebrew Wikipedia (and perhaps the Yiddish and Arabic ones). Our dates are written "j בF Y". Note the "ב" character before the month. With wikilinks: "[[j בF]] [[Y]]".

Fixed r86088
It pulls the translated month names and abbr. from the messages, and tries to match them in strings