Module talk:Wikidata date

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Testing[edit]

precision timestamp string {{#statements:P...|from=Q...}}
11 day +1643-09-18T00:00:00Z/11 18 September 1643 18 September 1643
10 month +2015-12-00T00:00:00Z/10 December 2015 December 2015
9 year +1979-00-00T00:00:00Z/9 1979 1979
8 decade -1210-01-01T00:00:00Z/8 1210s BCE 1210s BC
date QS:P,-1210-00-00T00:00:00Z/8
7 century -1700-01-01T00:00:00Z/7 17. century BCE 17th century BC
date QS:P,-1650-00-00T00:00:00Z/7
6 millennium -2000-00-00T00:00:00Z/6 2. millennium BCE 2nd millennium BC
date QS:P,-1500-00-00T00:00:00Z/6
5 ten thousand years
4 hundred thousand years -200000-01-01T00:00:00Z/4 200000 years BCE 200000 BC
3 million years
2 millennium -1950000000-01-01T00:00:00Z/2 1950 million years BCE 1950000000 BC
0 billion years -5000000000-00-00T00:00:00Z/0 5 billion years BCE 5000000000 BC

earliest date (P1319) or latest date (P1326) only cases should also evaluate mainsnak[edit]

If only earliest date (P1319) or latest date (P1326) is used the mainsnak should be evaluated, too. Currently this doesn't happen, e.g.:

  • before 7 November 1635
    date QS:P,+1635-11-07T00:00:00Z/7,P1326,+1635-11-07T00:00:00Z/11
    (code: {{#invoke:Wikidata date|date|item=Q2470815|property=P569|lang=en}}; from Creator:Claudio José Vicente Antolínez).

Best solution would be

  • "November 1635, before 7 November 1635"

if possible supported by Module:Complex date, better then now even

  • "between November 1635 and 7 November 1635".

Best, --Marsupium (talk) 08:21, 20 September 2017 (UTC)[reply]

As I move data from Creator templates to Wikidata I was creating a lot of dates with P1319 / P1326 properties or with "circa". I would not want main snak ewaluated in none of the cases I set up as it was usually just the decade or century of the event. I do not know how to distinguish the cases where I would want to evaluate main snak and the cases where I would not want that. --Jarekt (talk) 01:21, 21 September 2017 (UTC)[reply]
Can you give an example where you would no want it? At least for Creator:Claudio José Vicente Antolínez even fetching the year precision date is better than just the latest date (P1326) qualifier and this is the same with the other cases I remember. --Marsupium (talk) 17:25, 21 September 2017 (UTC)[reply]
@Jarekt: Another example is the date of death (P570) of Cornelis Vroom (Q578120) where https://rkd.nl/en/explore/artists/82219 says "1661-09/1661-09-16, buried on 16 Sept 1661". earliest date (P1319) can't really be given, though just "before 16 September 1661
date QS:P,+1661-09-16T00:00:00Z/7,P1326,+1661-09-16T00:00:00Z/11
/ 16 September 1661 / 1661" is not satisfying in my eyes. Of course mainsnak shouldn't be evaluated if both earliest date (P1319) or latest date (P1326) are set. I suppose this applies for the cases you refer to!? --Marsupium (talk) 19:21, 19 October 2017 (UTC)[reply]

"0000s" is not nice[edit]

Currently {{#invoke:Wikidata date|date|item=Q6787358|property=P571|lang=en}} gives "0000s" (test: 0000s AD

date QS:P,+0000-00-00T00:00:00Z/8

). That is not nice, should be at least 0s, perhaps this can be improved? --Marsupium (talk) 00:27, 19 October 2018 (UTC)[reply]

Time spans in various modules[edit]

We have time spans in various modules, see below! From Module:Wikidata art:

		if p.P580 or p.P582 then
			str = mw.ustring.format("%s (%s - %s)", p.value, p.P580 or '', p.P582 or '')
		elseif p.P585 then
			str = mw.ustring.format("%s (%s)", p.value, p.P585)
		else
			str = p.value
		end

and

		if p.P580 then
			str = mw.ustring.format("%s (%s - %s)", p.value, p.P580, p.P582 or '')
		end

From Module:Creator:

				description = string.format('%s (%s-%s)', description, args1.birthyear, args1.deathyear)

and

		if p.P580 or p.P582 then
			str = string.format("%s (%s–%s)", p.value, p.P580 or '', p.P582 or '')
		elseif p.P585 then
			str = string.format("%s (%s)", p.value, p.P585)
		else
			str = p.value
		end

From Module:Period:

			local getDate = require('Module:Wikidata date')._date
			local start = getDate(item, 'P580' , lang).str or getDate(item, 'P571' , lang).str
			local stop = getDate(item, 'P582' , lang).str or getDate(item, 'P576' , lang).str
			-- TODO: [[Module:Wikidata label]] has issues with RTL text when falling back to some LTR text,
			-- see the example at [[Template:Period/testcases]],
			-- has to get fixed there probably
			if start or stop then
				wikitext = string.format('%s (%s–%s)', wikitext, start or '', stop or '')
			end

Sometimes using something like "1789-1799" without and sometimes like "1789 - 1799" with spaces. Should we perhaps provide a function here to simplify harmonizing? Could also be useful for Template:ProvenanceEvent and others. --Marsupium (talk) 14:06, 19 October 2018 (UTC)[reply]