local main = {};
local monthIndices = {
['january'] = 1,
['february'] = 2,
['march'] = 3,
['april'] = 4,
['may'] = 5,
['june'] = 6,
['july'] = 7,
['august'] = 8,
['september'] = 9,
['october'] = 10,
['november'] = 11,
['december'] = 12
}
function main.hello(frame)
--[[
local args = frame.args
local arg1 = args[1]
local arg2 = args[2]
local arg3 = args[3]
local argNamed = args['named']
local s = 'Params: '
if (arg1 ~= nil) then s = s .. '1 = ' .. arg1 end
if (arg2 ~= nil) then s = s .. '; 2 = ' .. arg2 end
if (arg3 ~= nil) then s = s .. '; 3 = ' .. arg3 end
if (argNamed ~= nil) then s = s .. '; named = ' .. argNamed end
return s
]]
local args = frame.args
local input = args[1]
local day, matchMonth, year = input:match('^([0-9][0-9]?) ([A-Za-z]+) ([0-9][0-9][0-9][0-9])$')
if (matchDay == nil) then return input .. ' -> is not a recognized pattern match' end
--return matchDay .. '-' .. matchMonth .. '-' .. matchYear
local month = monthIndices[matchMonth:lower()]
if (month == nil) then return input .. ' -> does not have a recognized month name' end
--local day = matchDay -- :tonumber() ???
--local year = matchYear
return input .. ' -> parsed to ' .. year .. '-' .. month .. '-' .. day; -- won't add 0s
end
return main