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:49, 7 October 2020 (Created page with 'local getArgs = require('Module:Arguments').getArgs local p = {} function p.lastupdate(frame) local args = getArgs(frame) local lastupdatetime = args[0] -- s...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.lastupdate(frame)
	local args = getArgs(frame)
	local lastupdatetime = args[0] -- seconds since epoch
	local allowance = args[1] -- seconds allowed
	local current = os.time()
	
	local lang = mw.language.new('en')
	local display_date = lang:formatDate('j F Y', 'U' .. current)
	
	if current - allowance > lastupdatetime then
		return '<span class=error>' .. display_date .. '</span>'
	else
		return display_date
	end
	
end

return p