Jump to content

Module:Sandbox/CanonNi

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by CanonNi (talk | contribs) at 08:06, 2 November 2024 (fix error). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
local Date = require('Module:Date')._Date
local current = require('Module:Date')._current

local p = {}

function p.main(frame)
	local day
	
	if frame.args[1] then
		local success, result = pcall(function() return Date(frame.args[1]):text('dmy') end)
		if success then 
			day = result
		else
			error('Invalid date format in Template:Update')
		end
	else
		day = Date(current.year, current.month, current.day):text('dmy')
	end
	
	return string.format(": ''As of %s%s", day, frame.args[2] or '')
end

return p