Smalyshev added a comment.

So I think we should adopt the following approach for getting from Wikidata 
datetime to ISO/XSD datetime:

1. If date is Gregorian and positive - check it for ISO format breakage (0 
day/month, 31 February, etc.), fix it by replacing 0 with 1 and overflowing 
day/month with largest allowed value. Year 0 is treated as broken data and 
aborts conversion.
2. If date is Gregorian and negative, do the above and then if the precision is 
year or higher, then for XSD 1.1 mode add 1 to the year (i.e. move the year 1 
closer towards zero).
3. If the date is Julian, check the precision. If the precision is month or 
lower, treat the date as Gregorian above.
4. If the precision is day or higher, do the cleanups as in (1) and then 
convert the date to Gregorian. If converstion fails, this is bad data. Then 
process the negative years as described in (2).

This should give an expected result on most data, and should not do anything 
weird except in weird cases - like day-precision date with 10 billion years ago 
(which makes no sense).


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

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

To: Smalyshev
Cc: Liuxinyu970226, Jc3s5h, Smalyshev, Aklapper, daniel, jkroll, Wikidata-bugs, 
Jdouglas, aude, Manybubbles, JanZerebecki, Malyacko, P.Copp



_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to