mxn added a comment.

  This issue still affects any language that numbers its months instead of 
naming them. Chinese, Japanese, Korean, and Portuguese have been mentioned 
above, to which I’d add Vietnamese. These languages have narrow month “names” 
that are just bare numbers 
<https://unicode-org.github.io/cldr-staging/charts/41/summary/vi.html#62bca2005afce142>
 and instead rely on date formats to append a prefix or suffix to the month 
name.
  
  In T63958#3286620 <https://phabricator.wikimedia.org/T63958#3286620>, 
@thiemowmde wrote:
  
  > No matter what the users language is, everybody can distinguish day, month 
and year in "10 November 2017". But we can not assume everybody understands 
what the month in "2017-11-10" is. This is actually the 11th of October in 
certain regions of the world.
  
  As things stand, dates formatted by Wikibase aren’t necessarily recognizable 
as dates, let alone the correct dates. For example, Wikibase formats January 
25, 2002, as “25 1 2002 
<https://www.wikidata.org/wiki/Q10995651?uselang=vi#P571>”. By contrast, ever 
since T8910 <https://phabricator.wikimedia.org/T8910>, the rest of MediaWiki 
has correctly formatted the same date as “ngày 25 tháng 1 năm 2002” based on 
`$dateFormats['vi normal date']` (source 
<https://doc.wikimedia.org/mediawiki-core/1.34.4/php/MessagesVi_8php.html#a2fc93ea5327f655d3ed306e221ee33f0>).
 One might deduce that “25 1 2002” is a date in day-month-year format, but 
that’s hardly assured for every day of the year. It’s even worse with dates 
outside this millennium, like “22 11 874 
<https://www.wikidata.org/wiki/Q1010530?uselang=vi#P569>”. I wholeheartedly 
agree with commenters above that ISO 8601 format would’ve been preferable, even 
at the expense of temporarily regressing localized date formats in some other 
languages.
  
  The root cause seems to be this method 
<https://github.com/wikimedia/Wikibase/blob/8cd12697b6726cb052aa416765b197bc42188ad6/lib/includes/Formatters/MwTimeIsoFormatter.php#L119-L124>,
 which makes some language-centric assumptions. It correctly calls 
`getDateFormatString()` to get the localized date format, but then it scans the 
format string for a number followed by a period or comma 
<https://github.com/wikimedia/Wikibase/blob/8cd12697b6726cb052aa416765b197bc42188ad6/lib/includes/Formatters/MwTimeIsoFormatter.php#L138>
 and a word followed by a period or comma 
<https://github.com/wikimedia/Wikibase/blob/8cd12697b6726cb052aa416765b197bc42188ad6/lib/includes/Formatters/MwTimeIsoFormatter.php#L153>
 for the month component. It inserts these “formats” into a hard-coded string 
format `%s %s Y` then passes it into `sprintf()`. Effectively, it extracts a 
choice of the “Month” and “Day of the month” formatting codes in this table 
<https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#%23time> but 
discards any other information from the date format.
  
  In T63958#3284229 <https://phabricator.wikimedia.org/T63958#3284229>, 
@thiemowmde wrote:
  
  > @deryckchan, simply because the software must understand itself. The 
formatted date is what appears in the edit field. We do not want to show the 
unformated YYYY-MM-DD there as this would be even more confusing, so we show it 
formatted. You want to edit this, and expect the software to accept the format 
it was outputting before.
  >
  > With no parser that is able to understand all formats (and not confuse 
them!) we can't output all formats.
  
  It is possible to solve this problem without mangling date formats. For 
example, the Comments in local time 
<https://en.wikipedia.org/wiki/User:Mxn/CommentsInLocalTime#Site_options> 
gadget accepts a list of date format strings to parse out of talk pages 
(`parseFormat`). On a wiki whose system date format has changed over the years, 
it’s no big deal to accept multiple formats 
<https://vi.wikipedia.org/wiki/Đặc_biệt:Liên_kết_thường_trực/61986137#L-22>. As 
it happens, MediaWiki’s `$dateFormats['vi normal date']` setting provides these 
formats in a `sprintf()`-compatible syntax.
  
  If the goal is to accept a date in any format, that’s laudable, but it 
shouldn’t preclude outputting a date in the correct format. `parseDate()` 
doesn’t **have** to call the same function 
<https://github.com/wikimedia/Wikibase/blob/8cd12697b6726cb052aa416765b197bc42188ad6/repo/includes/Parsers/DateFormatParser.php#L328>
 as `getLocalizedDate()`. `getLocalizedDate()` can consult `$dateFormats` while 
`parseDate()` continues to sniff formatting characters out of a format string.

TASK DETAIL
  https://phabricator.wikimedia.org/T63958

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: mxn
Cc: mxn, Lens0021, Jony, Kwj2772, Jarekt, C933103, Capankajsmilyo, jeblad, 
PokestarFan, revi, Phreelance, KTC, Samat, deryckchan, Nikki, Agabi10, 
gerritbot, thiemowmde, RP88, Aklapper, Mbch331, Ricordisamoa, Liuxinyu970226, 
Wikidata-bugs, Addshore, He7d3r, PiRSquared17, Lydia_Pintscher, Stryn, 
Astuthiodit_1, Prufkick, karapayneWMDE, Invadibot, maantietaja, ItamarWMDE, 
Akuckartz, Nandana, lucamauri, Lahi, Gq86, GoranSMilovanovic, QZanden, 
LawExplorer, _jensen, rosalieper, Scott_WUaS, Srdjan, MuhammadShuaib, LNDDYL, 
Psychoslave, aude, Gryllida, Shizhao, Arrbee, Jay8g
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to