Module:SacroboscanTimes
From Fallen London Wiki (Staging)
Documentation for this module may be created at Module:SacroboscanTimes/doc
-- Based on 'Module:RatWeekend' by [[User:Tirerim]]
local p = {}
local function event_start_for_time(time)
local weekday = os.date("%w", time)
local thursday = (4 - weekday) * 86400 + time
if weekday == '0' or weekday == '1' or weekday == '2' or weekday == '3' or (weekday == '4' and os.date("%H%M", time) < '1200') then
thursday = thursday - (7 * 86400)
end
return thursday
end
local function date_for_offset(offset)
local current_time = os.time()
local start_day = event_start_for_time(current_time)
start_day = start_day + (offset * 7 * 86400)
local end_day = start_day + (7 * 86400)
return os.date("%b %d", start_day) .. ' - ' .. os.date("%b %d", end_day)end
function p.event_time(frame)
local current_event = frame.args[1]
local future_event = frame.args[2]
local offset = (tonumber(future_event) - tonumber(current_event)) % 9
--return os.date("%w", os.time())
return date_for_offset(offset)
end
return p