TestcasesEdit


f = {}

function f.format(frame)
	template = frame.args[1]
	language = mw.language.new("en")
	date = language:formatDate("j F Y")
	template = mw.text.nowiki(template)
	
	local accessdate = string.find(template, "access%-?date ?= ?")
	if accessdate ~= nil then
		local datePosition = accessdate[2]
		local beforeDate = string.sub(template, 1, datePosition)
		local afterDate = string.sub(template, datePosition + 1, -1)
	end
	if beforeDate and afterDate then
		return beforeDate .. date .. afterDate
	else
		return template
	end
end

return f