Page MenuHomePhabricator

Wikidata Query Service outputs 28th February for 29th February
Open, Needs TriagePublicBUG REPORT

Description

This item has 29th February 2022 inserted as one of the qualifiers in property 1435:
https://www.wikidata.org/wiki/Q82657076
https://www.wikidata.org/wiki/Special:EntityData/Q82657076.json

However, WQS reads this as 28th February:
https://w.wiki/73ns

Isn't that strange? I know that 2022 was not a leap year, but I would still expect WQS to output the real situation.

Event Timeline

Wikibase’s DateTimeValueCleaner converts greater-than-possible days in a month to the last day in the month:

$max = cal_days_in_month( CAL_GREGORIAN, $m, $safeYear );
// We just put it as the last day in month, won't bother further
if ( $d > $max ) {
	$d = $max;
}

We could make it return null instead, which would mean that the date would get exported as a string in RDF, instead of as an xsd:dateTime. (I believe this also happens when the year is set to 0, for example.)

In either case, this is actually an issue in the Wikibase RDF export, the query service isn’t doing anything special. (But maybe it still makes sense to keep it tagged, so not untagging it yet.)

Hmmm that seems not good because it's basically wrong data.
If we can't output the date in the way it's in Wikidata then I'd lean towards not outputting it as a second best option.

Thank you Lucas for explaining the issue.

@Lydia_Pintscher Yes, that was my point. Tools or bot operators who use the WQS to get data can run into errors because of this.

Let's keep the WDQS tag on this ticket because if you change how the RDF output is generated we might have to re-import the data to WDQS to make sure that all these dates get cleaned-up.