Documentation for this module may be created at Module:Sandbox/Dalba/Sandbox/doc

local p = {}

function p.main(frame)
    local args = {}
    local v, i = 0
    for i, v in ipairs(frame:getParent().args) do args[i] = v end
    return p.choose(args)
end

function p.choose(options)
    -- return each one of the options during the week
    local week_start_time = os.time({year=os.date('%Y'), month=os.date('%m'), day=os.date('%d') - os.date('%w'), hour=0, sec=0})
    local time_slice = 7 * 24 * 3600 / #options
    local current_option_index = math.floor((os.time() - week_start_time) / time_slice) + 1
    return options[current_option_index]
end

return p