Page MenuHomePhabricator

Date format on the Revision Slider
Closed, ResolvedPublic3 Story Points

Description

Please consider changing the date format to the full "gen" format.

In some languages, it is not acceptable to use the shortened format, and there seems to be enough space to view the full date.

Thanks in advance,
Guy.

Event Timeline

Guycn2 created this task.Jul 23 2016, 12:42 AM
Restricted Application added a project: TCB-Team. · View Herald TranscriptJul 23 2016, 12:42 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Guycn2 updated the task description. (Show Details)Jul 23 2016, 5:14 AM

Some more information would be very appreciated here. For example what language version should we consider to see the problem, or how should the formatted timestamp should look like.

Our goal was to have the date formatted the same way the dates on history page and in the diff column headers are formatted, for consistency.
We were only able to check a limited set of languages and scripts, so it is very possible there are differences in some language versions. Pointing those out would be very helpful.

In Hebrew, January 20, 2005 looks

20
בינואר 2005

in history page, but

20
ינו' 2005

in slider (I added linefeeds for rtl consistency).

Thanks @IKhitron !
I would swear I tried to check how it looks in Hebrew but either I took wrong months or I simply wasn't careful enough when comparing signs. Definitely the latter.

I'll try to look into this.

WMDE-leszek set the point value for this task to 3.Aug 2 2016, 12:00 PM
WMDE-leszek moved this task from Proposed to Backlog on the TCB-Team-Sprint-2016-08-02 board.
Lea_WMDE moved this task from Incoming to Doing on the Revision-Slider board.Aug 3 2016, 3:13 PM
WMDE-leszek moved this task from Backlog to Doing on the TCB-Team-Sprint-2016-08-02 board.

Another date formatting related problem: T142262

WMDE-leszek triaged this task as Normal priority.Aug 9 2016, 8:45 AM

Change 303788 had a related patch set uploaded (by WMDE-leszek):
[DNM] Use moment.js's localized date and time format

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

WMDE-leszek added a comment.EditedAug 9 2016, 11:25 AM

The biggest problem when it comes to the way date and time are displayed by RevisionSlider is that RevisionSlider is written in JavaScript (it is almost fully run by user's browser, not by server running MediaWiki). To the best of my knowledge it is not possible to call core's date and time formatting functions from Javascript (at least not currently). External library, moment.js [1] is used instead.
While having a possibility to use moment.js from client-side code is nice as it provides quite sophisticated ways to display date and time in localized manner, not having a way to do the exact same things the core does on server-side is a bit of shame.
Among others (basically all points lead to the issue @Guycn2 reported here):

  1. Moment.js provides quite a few ways to format date and time [2] but still those does not seem to cover all formatting options that MW core uses (more about this below).
  2. There are/might be cases where MW displays particular things different than moment.js using similar format. See for instance the apostrophe issue reported in T142262, or (if I am not mistaken) differences in "July" in Hebrew (MW vs moment): ביולי vs יולי.
  3. User can change the way core displays date and time in user preferences. Client-side code cannot really handle this and adjust the way of displaying date and time to user preferences (this might be possible to some extent and with quite some limitations but even so it would be rather tricky)
  4. (no quote here) MW seem to cover more languages/locales than moment.js [3]

Although I'd be very happy to have a way to make client-side and server-side parts of MW generate exactly the same date and time, it does not seem to be trivial task, so it might not happen very soon to have such feature in MW JS code.
For now we have to stick to what we have and try to use moment.js in a way that would be most flexible so users of different language versions could actually understand what RevisionSlider shows.

It has been definitely a wrong decision of us to stick to the default date format used in English version, ie. time + comma + day + short name of month + year. It is not even consistent with server-side code which uses a full month name for English.

Having looked at what possibilities moment.js provides we have came to the conclusion that RevisionSlider could either:
A. Use the existing format but with full month name, ie: time + comma + day + full month name + year. Speaking in moment.js format would be HH:mm, D MMMM YYYY, or
B. Use moment.js's localized format including day, month and a year (LLL in moment.js). This format does not stick to a specific order of components but uses language-specific order instead, and also follows rules of grammar of the language.

I did a little test to see how options A and B work for some languages, also comparing those to how Mediawiki core displays date and time. This is also important as we would like RevisionSlider to display date and time in possibly similar way core does, so users are not confused with dates being displayed different on history page and above diff columns on the diff page, and different in RevisionSlider's popup.

I've collected "results" of this tests in the table below. I picked some languages using Latin script and some languages written in non-Latin script, and had MW core and moment.js display the date of "9th of August 2016, 11:48)". The scope of the test is definitely very narrow. I should have picked more non-Latin scripts, and more languages. So one should be rather careful when trying to make any conclusions based on the table below.
I hope I didn't mess up direction of RTL texts and Hebrew and Arabic dates are actually readable. Please report if they are not.

langMW core, history pageMW core, diff headerMoment.js, current format (HH:mm, D MMM YYYY)Moment.js new format, option A (HH:mm, D MMMM YYYY)Moment.js, new format, option B (LLL)
en11:48, 9 August 201611:48, 9 August 201611:48, 9 Aug 201611:48, 9 August 20169 August 2016 11:48 AM
de11:48, 9. Aug. 20169. August 2016, 11:48 Uhr11:48, 9 Aug. 201611:48, 9 August 20169. August 2016 11:48
es11:48 9 ago 201611:48 9 ago 201611:48, 9 ago. 201611:48, 9 agosto 20169 de agosto de 2016 11:48
pl11:48, 9 sie 201611:48, 9 sie 201611:48, 9 sie 201611:48, 9 sierpnia 20169 sierpnia 2016 11:48
fi9. elokuuta 2016 kello 11.489. elokuuta 2016 kello 11.4811:48, 9 elokuu 201611:48, 9 elokuu 20169. elokuuta 2016, klo 11.48
ru11:48, 9 августа 201611:48, 9 августа 201611:48, 9 авг 201611:48, 9 августа 20169 августа 2016 г., 11:48
he‏11:48, 9 באוגוסט 2016‎‏11:48, 9 באוגוסט 2016‎‏11:48, 9 אוג׳ 2016‎‏ 11:48, 9 אוגוסט 2016‎‏9 באוגוסט 2016 11:48‎
ar‏ ١١:٤٨، ٩ أغسطس ٢٠١٦‎‏١١:٤٨، ٩ أغسطس ٢٠١٦ ‎‏ ١١:٤٨، ٩ آب أغسطس ٢٠١٦‎‏ ١١:٤٨، ٩ آب أغسطس ٢٠١٦‎‏٩ آب أغسطس ٢٠١٦ ١١:٤٨‎
zh2016年8月9日 (二) 11:482016年8月9日 (二) 11:4811:48, 9 8月 201611:48, 9 八月 20162016年8月9日中午11点48
ko2016년 8월 9일 (화) 11:482016년 8월 9일 (화) 11:4811:48, 9 8월 201611:48, 9 8월 20162016년 8월 9일 오전 11시 48분
ja2016年8月9日 (火) 11:482016年8月9日 (火) 11:4811:48, 9 8月 201611:48, 9 8月 20162016年8月9日午前11時48分

Few remarks after having looked at the table:

  • I must admit I was suprised how many languages use similar format to English (with time first). I am wondering how much this is a natural way of showing date and time in a language, and how this has been influence by English format used in MW.
  • it seems full month names should be used in favour of short names, even if for some languages (Polish, Spanish) MW core uses short names; More languages use full names, and as far as I can tell full names don't do harm for other languages,
  • even if the language uses format similar to English in MW core there might be slight differences if formatting, see ordinal numeral in German, or no comma after time in Spanish,
  • new format option B seems understandable in languages I could read, even if it is not exactly the same as in MW, e.g. "AM" and twelve-hour time for English, slightly different introducing time in Finnish, different order of date and time in Polish in Russian.
  • new format option B seems also more verbose (e.g. use of genitive in Spanish),
  • date in "new format option A" is not grammatically correct in Finnish (wrong case is used for month name), while "new format option B" is,
  • not sure about Hebrew but at first glance Arabic month name seem a bit different in MW core and moment.js dates
  • current format we use with moment.js and "new format option A" look really strange for Chinese, Korean and Japanese compared to formats used by MW and to "new format option B". I've also talked about Korean formats with Korean-speaking colleague who said those other moment.js formats are no go in case of Korean.

Having considered those points I'd tend to switch RevisionSlider to use new format option B. Unfortunately it is not consistent with the way MW core displays dates but on the other hand it assures better that dates displayed by RevisionSlider are understandable in language other than English, grammatically correct and closer to natural way of writing dates in a language.

Note: I don't feel like making any, even partly, valid statements on results for: Hebrew, Arabic, Chinese, Japanese. I could only compare signs of those language and with my glasses on it looks like my conlusion "new format option B" looks like the best of moment.js options would be still sound.

I went ahead and submitted a patch changing the format used by RevisionSlider to moment's LLL [4].

Still I'd be glad to hear others opinions on that. Maybe it makes more sense to try to be more
In particular @Guycn2, @IKhitron could you please have a look at Hebrew dates and see if they make sense?

Also if you know there is some more languages we should consider, please comment and we'll see how moment.js deals with them!

[1]http://momentjs.com
[2] http://momentjs.com/docs/#/displaying/
[3] https://phabricator.wikimedia.org/diffusion/MW/browse/master/resources/lib/moment/locale/
[4] https://gerrit.wikimedia.org/r/#/c/303788/

oh no, Hebrew and Arabic texts are completely broken. I messed copying from my editor, or it was Phabricator. Any way, I am trying to fix this right now!

For hewiki, format B looks fine. Looks A is "forgivable" and can be used if needed.

@WMDE-leszek, thank you for the detailed explanation. In Hebrew, the most acceptable format is LLL, which is option B on the table.

Option A is problematic because it does not show the month name in the genitive form.

Hebrew and Arabic should now be displaying correctly in the table above

There has not been that much time given for possible discussion about change the format of date but as revision slider is currently used in a small set of wikis we might simply not be able to reach people knowing languages which might be relevant here.

But given we had comments on LLL format being OK Hebrew, and my own observations also favouring this format, I'd suggest that we switch to this format and wait for feedback. If the format is wrong for some other languages, or not acceptable for some languages revision slider was "available" with before, we will hopefully hear on this sooner than later.

I make my patch available for review, and see how it goes forward.

Change 303788 merged by jenkins-bot:
Use moment.js's localized date and time format

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

Tobi_WMDE_SW closed this task as Resolved.Aug 29 2016, 12:48 PM
Addshore moved this task from Doing to Done on the Revision-Slider board.Sep 13 2016, 2:49 PM