Module:Calendar date

From Phuketer
Revision as of 17:44, 16 June 2026 by Maintenance script (talk | contribs) (ABC final compatibility shim: add calendardate function)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Calendar date/doc

-- ABC local compatibility shim for imported Wikipedia calendar-date calls.

local p = {}

local function render(frame)
	local args = frame and frame.args or {}

	if args[1] and tostring(args[1]) ~= '' then
		return tostring(args[1])
	end

	if args.date and tostring(args.date) ~= '' then
		return tostring(args.date)
	end

	return ''
end

p.main = render
p.calendardate = render
p.calendarDate = render
p._main = function(args)
	if args and args[1] then
		return tostring(args[1])
	end
	return ''
end

setmetatable(p, {
	__index = function(t, k)
		local f = function(frame)
			return render(frame)
		end
		rawset(t, k, f)
		return f
	end
})

return p