Page MenuHomePhabricator

Wrong date values for day and month precision
Closed, ResolvedPublic8 Estimated Story PointsBUG REPORT

Description

API allow to add wrong date values for day and month precision. For example:
+2003-12-00T00:00:00Z with precision = DAY
+2003-00-00T00:00:00Z with precision = MONTH
The values can not be displayed correctly by Wikidata UI.
See P577 value at page as example:
https://www.wikidata.org/w/index.php?title=Q4115189&oldid=1485553016

I fixed such wrong values. But its are created again and again by different users.
See the next discussions as examples:
https://www.wikidata.org/wiki/User_talk:Rdmpage#Date_format
https://www.wikidata.org/wiki/User_talk:Csisc#Corrupted_dates

Steps to reproduce

  1. Go to https://www.wikidata.org/wiki/Special:ApiSandbox
  2. Set action = wbcreateclaim
  3. entity = Q4115189
  4. snaktype = value
  5. property = P577
  6. value = {"time": "+2003-12-00T00:00:00Z", "precision": 11, "timezone": 0, "before": 0, "after": 0, "calendarmodel": "http://www.wikidata.org/entity/Q1985727"}
  7. token -> click autofill
  8. Execute request

Actual behavior
Wrong claim is successfully created.

Expected behavior
The API call should fail with invalid-snak code. The claim should not be created. Behavior should be the same as for other wrong date values, for example for "+2003-99-99T00:00:00Z".

Acceptance criteria:

  • dates with 00 for the month and precision month or day are no longer accepted by the API
  • dates with 00 for the day and precision day are no longer accepted by the API

Notes:

  • We need to make sure that the Items with wrong values don't become completely uneditable. It should at the very least be possible to remove the statement with the invalid date.
  • Dev team does not clean up existing bad data

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptAug 22 2021, 8:10 AM
Addshore set the point value for this task to 8.Sep 22 2021, 10:39 AM

Change 726608 had a related patch set uploaded (by Noa wmde; author: Noa wmde):

[mediawiki/extensions/Wikibase@master] WIP: Check that Month and Day are not 0 for respective precision

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

Change 726608 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Check that Month and Day are not 0 for respective precision

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

Thank you! I fixed remaining bad values.