Page MenuHomePhabricator

Allow different formats of dates depending on the language
Closed, DuplicatePublic

Description

Currently, when entering a date in a value, a specific format is expected (the american format MM-DD-YYYY).

In French and other languages, it's confusing, because the usual format is DD-MM-YYY.
When one enter 02/03/2017 in the field, the date is February 3rd when French editor expect March 2nd.

Also in French we write "1er" for the first (equivalent of 1st) and it would be great if typing "1er mars 2017" would be correctly interpreted.

Event Timeline

thiemowmde claimed this task.

This is indeed a duplicate of T167788, as well as closely related to other existing tickets.

This tasks description is a little misleading. It's not always "the american format MM-DD-YYYY" that is expected. This depends a lot on the date you are trying to input, and on the separator character you are using.

All this works as expected:
https://www.wikidata.org/w/api.php?action=wbparsevalue&datatype=time&values=02-03-2017
https://www.wikidata.org/w/api.php?action=wbparsevalue&datatype=time&values=02.03.2017
https://www.wikidata.org/w/api.php?action=wbparsevalue&datatype=time&values=31/03/2017

The confusion only happens if you use slashes, and the day is in the range from 1 to 12 and can be confused with the month. The parser can not do anything but assume something, and assumes the MM/DD/YYYY format.
https://www.wikidata.org/w/api.php?action=wbparsevalue&datatype=time&values=02/03/2017

As already explained in T167788 this can not really be fixed by considering the users language, IP address, or geo location. The language might have been set to "en", but the user might still assume "DD/MM/YYYY". Or vice versa.

I do have a few ideas how to improve the situation, including parsing the users preferred date format, trying to understand if it shows the day or the month first, and providing this as an additional hint to the parser chain we are using.