Last modified: 2014-04-30 15:09:01 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66084, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64084 - Time data-type inconsistently zero-pads year value (dates earlier than year 1000?)
Time data-type inconsistently zero-pads year value (dates earlier than year 1...
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: High major with 1 vote (vote)
: ---
Assigned To: Wikidata bugs
u=dev c=backend p=0
: need-volunteer
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-18 04:50 UTC by gnosygnu
Modified: 2014-04-30 15:09 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description gnosygnu 2014-04-18 04:50:21 UTC
== REPRODUCTION ==
* Go to https://www.wikidata.org/wiki/Special:Export/q937 and get the value for p570
* Go to https://www.wikidata.org/wiki/Special:Export/q44269 and get the value for p570
* For convenience's sake, the two values are listed below:
q937   +00000001955-04-18T00:00:00Z
q44269 +000000000343-12-06T00:00:00Z
* Note that the date with year 343 has an extra leading 0

== RELEVANCE ==
* See https://bugzilla.wikimedia.org/show_bug.cgi?id=30148#c11 for an example of how this causes a bug elsewhere
* Basically, Module code is calling string.sub(d, 9, 18), and is not expecting the year 343 date to have an extra 0
: It ends up extracting a date of "00343-12-0" and triggers the year 10,000 bug.
* As a result, Nicolau de Mira shows up as having died in 2003 instead of 343.

== OTHER NOTES ==
* This does not appear related to https://bugzilla.wikimedia.org/show_bug.cgi?id=26181 which is for the semantic wiki
Comment 1 Addshore 2014-04-22 10:34:04 UTC
The years are currently always padded by the TimeValue when being stored.
As time has passed the level of padding has changed.

Can you not just trim the 0s from the left of the string extracted?
Comment 2 gnosygnu 2014-04-23 03:15:20 UTC
This is a sensible suggestion, but the script was not written by me. I only happened to come across this issue on Catalan Wikipedia while investigating the Year 10,000 bug. See: https://bugzilla.wikimedia.org/show_bug.cgi?id=30148#c11 

I would leave a note on the talk page, but it is a non-English wiki, and I generally don't know what the policy is for feedback in other languages (do I translate the note using an online translator?)  

In addition, there would probably be multiple wikis that need to be changed. In addition to Catalan, there are four other wikis that use similar logic for their main Wikidata Module. See the list below.

Hope this helps.

=== affected: uses "9" as substring for date ===
- https://ca.wikipedia.org/wiki/Module:Wikidata
- https://en.wikipedia.org/wiki/Module:Wikidata
- https://fr.wikipedia.org/wiki/Module:Wikidata/Dates
- https://es.wikipedia.org/wiki/Module:Wikidata
- https://uk.wikipedia.org/wiki/Module:Datetime/Wikidata

=== unaffected: uses a regex ===
- https://de.wikipedia.org/wiki/Module:Wikidata
- https://it.wikipedia.org/wiki/Module:Wikidata
- https://sv.wikipedia.org/wiki/Module:Time

=== currently unaffected: no code handling time data-type ===
- https://ru.wikipedia.org/wiki/Module:Wikidata
- https://hu.wikipedia.org/wiki/Module:Wikidata
- https://no.wikipedia.org/wiki/Module:Wikidata

=== currently unaffected: Module:Wikidata doesn't exists ===
- https://nl.wikipedia.org/wiki/Module:Wikidata
- https://pl.wikipedia.org/wiki/Module:Wikidata
- https://ar.wikipedia.org/wiki/Module:Wikidata
- https://ja.wikipedia.org/wiki/Module:Wikidata
- https://zh.wikipedia.org/wiki/Module:Wikidata
- https://pt.wikipedia.org/wiki/Module:Wikidata
- https://vi.wikipedia.org/wiki/Module:Wikidata

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links