FANDOM


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 days = stringToTimestamp(frame.args[1]) / (60*60*24)
    local rotate = frame.args[2] or 0
 
    local mod = (days + rotate) % 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

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.