Documentation for this module may be created at Module:Significant events/doc

local p = {};

function p.main(frame)
	local args = frame.args
	local pargs = frame:getParent().args
	local qid = args.qid or pargs.qid or ""
	if qid == "" then
		qid = mw.wikibase.getEntityIdForCurrentPage()
	end
	if not qid then
		return ''
	end
	local dates = {}
	local statements = mw.wikibase.getBestStatements(qid,'P571')
	for i,statement in ipairs(statements) do
		if statement.mainsnak.snaktype == 'value' then
			dates[#dates+1] = statement.mainsnak.datavalue.value.time
		end
	end
	return dates[1]
end

return p