Jump to content

Module:Sandbox/CAS222222221

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 風中的刀劍 (talk | contribs) at 12:45, 10 September 2015. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

require('Module:No globals')
local getArgs = require('Module:Arguments').getArgs
local p = {}

local function dateCov(inp)
	local months = {'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'}
	
	for i, v in ipairs(months) do
		local pattern = '(' .. v .. ' %d{1,2}, %d{4})(.*)'
		if string.find(inp, pattern) then
			local _, _, a, b
			return mw.language.new('zh'):formatDate('Y年Mj日', a, nil) .. b
		end
	end
end

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	-- Main module code goes here.
	return dateCov(args[1])
end

return p