FANDOM


local p = {}
 
local monthData = mw.loadData( 'Module:Month/data' )
local getArgs = require('Dev:Arguments').getArgs
local monthAliases = monthData[1]
local monthNumbers = monthData[2]
 
function p.month( frame )
	local args = getArgs(frame)
	return p._month(args)
end
 
function p.trim( s, charset )
	if s == nil then
		return ''
	end
	charset = charset or '\t\r\n\f '
	s = mw.ustring.gsub( s, '^[' .. charset .. ']*(.-)[' .. charset .. ']*$', '%1' )
	return s
end
 
function p._month( args )
	local month = p.trim( args[1] )
	local monthAlias = monthAliases[string.lower( month )]
	if monthAlias ~= nil then
		return monthAlias
	end
	return month
end
 
function p.monthNo( frame )
	local month = p.trim( frame.args[1] )
	local monthNumber = monthNumbers[string.lower( month )]
	if monthNumber ~= nil then
		return monthNumber
	end
	return month
end
 
return p
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+