Page MenuHomePhabricator

lang:formatDate doesnt work properly with timestamps from Wikidata (year only)
Closed, InvalidPublic

Description

I have some problems with the Funktion

lang:formatDate

If I get data from WIkidata with qulifiers it doesn't work properly, if a year only is stated. Take a look at Truckee. The qulaifier for the population is just a year (2013). If i fetch the data from Wikidata I get this string +2013-00-00T00:00:00Z. See the dump (Truckee dump). But the format function delivers 2012. See the playground on Wikivoyage: Playground

I have setup a workaround by replacing -00-00T00:00:00Z with the 1st of January: -01-01T00:00:00Z

But the formatting function should format it properly or Wikidata should store a year only in a different way

Event Timeline

thiemowmde subscribed.

formatDate is a MediaWiki core function. It accepts a few different formats, but they are all so heavily restricted that it's just not possible to use formatDate to format Wikidata timestamps. For example, Wikidata timestamps can have many different precisions, can be negative, can be millions of years in the future. formatDate does not accept all this.

Please use a proper formatter. There are Lua modules build by the community to do this.