Module:ElementalHall

local p = {}

local function stringToTimestamp(s) local monthName, day, year = string.match(s,"(%w+)%s+(%d+),?%s*(%d+)") local MON={January=1,February=2,March=3,April=4,May=5,June=6,July=7,August=8,September=9,October=10,November=11,December=12,Jan=1,Feb=2,Mar=3,Apr=4,May=5,Jun=6,Jul=7,Aug=8,Sep=9,Oct=10,Nov=11,Dec=12} local month=MON[monthName] return os.time({year=year, month=month, day=day, hour=0, min=0, sec=0}) end

--[[ this function expects a single template argument which is a Date formatted as: August 30 2016

using any other format will cause the code to fail ]]-- function p.elementForDate(frame) local timestamp = stringToTimestamp(frame.args[1]) local mod = timestamp % 4 if    mod == 0 then return dark elseif mod == 1 then return passion elseif mod == 2 then return cool --    mod == 3 else                return light end end

return p