Jump to content

Module:User:SDZeroBot

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SD0001 (talk | contribs) at 12:54, 7 October 2020. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.lastupdate(frame)
	local args = getArgs(frame)
	local lang = mw.language.new('en')
	
	local lastupdate = lang:formatDate('i', args[0])
	local allowance = args[1] -- seconds 
	local current = os.time() -- seconds since epoch

	local display_date = lang:formatDate('j F Y', args[0])
	
	if current - allowance > lastupdate then
		return '<span class=error>' .. display_date .. '</span>'
	else
		return display_date
	end
	
end

return p