{{i}} Документація модуля[створити]
local M = {}

function M.parseWikidataTimeobj(value)
	--модифіковано з https://fr.wikipedia.org/w/index.php?title=Module:Wikidata/Dates&oldid=97311830
	local timestamp = value.time
	local precision = value.precision
	local era = '+' -- (after Christ)
	if string.sub(timestamp,1,1) == '-' or  string.sub(timestamp,2,12) == '00000000000' then  -- Before Christ or year 0 (see datamodel)
		era = '-' 
	end 
	local century = nil
	if precision >= 7 then 
		century = tonumber(string.sub(timestamp, 9, 10))
		if era == '-' then
			century = century + 1
		end	
	end
	local year = nil
	if precision >= 9 then 
		year = tonumber(string.sub(timestamp, 9, 12))
		if era == '-' then -- remove one Year for BC years because of year 0
			year = year + 1
		end
	end
	local month = nil
	if precision >= 10 then
		month = tonumber(string.sub(timestamp, 14, 15))
	end
	local day = nil
	if precision >= 11 then
		day = tonumber(string.sub(timestamp, 17, 18))
	end
	local calendar = 'gregorian' -- calendar for display, not storage
	if value.calendarmodel == 'http://www.wikidata.org/entity/Q1985786' then
		calendar = 'julian'
	end
	return {century = century, year=year, month=month, day=day, calendar=calendar}
end

return M