Page MenuHomePhabricator

Have a calendar converter for input dates at wikidata
Open, Needs TriagePublic

Description

Now the only calendar for inputting data in Wikidata is the Gregorian calendar. there are some other local calendars which are supported by MediaWiki at [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time here] (Arabic, Persian, Hebrew, Thai solar, Minguo, Japanese nengo). some article's data are base on these calendars and users should convert them to Gregorian to input them at Wikidata and it is difficult.

Please Develop a gadget (maybe a JS tool) which converts these calendar to Gregorian to input them at Wikidata. I didn't propose to change the database date format I only suggested a converter gadget.

Wikidat_calendar.jpg (337×1 px, 72 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

The first day the Gregorian calendar was used was 15 October 1582. Dates before that should be converted to the other calendar supported by Wikidata, the Julian calendar.

The task description gives a link and claims Arabic, Persian, Hebrew, Thai solar, Minguo and Japanese nengo are supported. But the link claims a time object must be acceptable to PHP's strtotime() function. The linked documentation for that function refers to https://php.net/manual/en/datetime.formats.php for the acceptable formats. That page has no mention of non-Gregorian calendar support.

There seems to be some miscommunication and misunderstanding here that I might be able to clarify.

MediaWiki supports several calendars in addition to what PHP supports itself (through strtotime() etc.) For instance, MediaWiki has supported for Solar Hijri calendar (aka Iranian calendar) since 827d6dcd86bf5bc3340ac5556b757434710691c2 (which I committed in 2007) and similarly for several other calendar systems (the Lunar Hujri calendar, aka Arabic calendar, the Hebrew calendar, and so forth).

What is being asked here, I believe, is that users of Wikidata can look at an item that has some date attributes, and instead of (or in addition to) seeing the dates in their original format (which is a data type of "Point in time" shown as a Gregorian date, see for instance P569) they would like to have the ability to see that date converted into a different calendar system.

None of the algorithms we have for converting between calendar systems are 100% accurate (for reasons that go beyond this discussion), and they are especially inaccurate for dates that are one or more centuries in the past or in the future. We are using them in MediaWiki to show the current date in a different calendar system, for which they tend to be much more accurate. In Wikidata, however, I would venture a guess that many/most dates are not for relatively current events.

Additionally, the data in Wikidata is also probably subject to similar inaccuracies. What you find as the date of birth of Ibn Arabi (28 July 1165) is probably based on some conversion someone did from the Lunar Hijri calendar to the Gregorian calendar (as the original documents about him in which his date of birth is mentioned are in Arabic and mention it in the Lunar Hijri calendar only). As stated above, all of these conversions are subject to assumptions and inaccuracies, and converting them back to the Lunar Hijri calendar might give a result different form the original date (e.g. because different algorithms were used for each of the two date conversions).

So all in all, I am not in favor of making this a core feature. Instead, I think what we should do is (a) make sure that date fields contain meta-data that shows that date in some standard format (e.g. an ISO 8601) and (b) create front-end gadgets for Wikidata that can consume this metadata and show the date in any additional calendar systems.

So for instance, when you go to Ibn Arabi and look at the HTML source of the page for the DIV element that contains the date of birth, you should find some attribute like data-date-ISO-value="1165-07-28" so that a JS-based gadget then be able to find all fields with a data-date-ISO-value attribute and run conversions as desired by the user. (Of note, JS implementations for all these calendar system conversion algorithms exist, and they are pretty light to run on the client-side).

@Huji The task description talks about inputting data, not reading data that is already present.

When it comes to Wikidata, ISO is a dirty word. First of all, Wikidata supports two calendars, Gregorian and Julian. ISO 8601 only allows Gregorian. So whenever you write ISO, you are writing that you are going to ignore all Julian dates that have been entered into WIkidata, or you are going to falsify them by pretending they are Gregorian when they are not.

Using Isaac Newton as an example, his birthdate is December 25, 1642, Julian. Looking at the page source, one find this (just cut and paste, no attempt to get the whole statement, whatever that is)

{\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P569\",\"datavalue\":{\"value\":{\"time\":\"+1642-12-25T00:00:00Z\",\"timezone\":0,\"before\":0,\"after\":0,\"precision\":11,\"calendarmodel\":\"http://www.wikidata.org/entity/Q1985786\"}

If one interprets the "1642-12-25" but ignores "http://www.wikidata.org/entity/Q1985786\" one gets the wrong answer.