Module:Weekly site information
This Lua module is a high priority for maintenance as it is original to the OWOT Wiki and used in articles. As such, this module may contain bugs and it should be a top priority of module maintainers to quickly fix any issues that arise with it. Discuss breaking changes on the talk page before implementing them. |
This module implements {{Weekly site information}}
.
local p = {}
local function release(prev)
local first_date = os.time{year=2024, month=9, day=8}
local curr_date = os.date("*t", os.time())
if prev == true then
curr_date.day = curr_date.day - 7
end
curr_date = os.time(curr_date)
local diff = os.difftime(curr_date, first_date) / (24 * 60 * 60)
local release_num = math.floor(diff / 7)
local end_date = os.date("*t", curr_date - (diff % 7) * 24 * 60 * 60)
end_date.day = end_date.day - (end_date.wday - 1)
local start_date = os.time{year=end_date.year, month=end_date.month, day=end_date.day - 7}
return release_num .. " " .. os.date("%b %d", start_date) .. " - " .. os.date("%b %d", os.time(end_date))
end
function p.most_recent()
return release(false)
end
function p.previous()
return release(true)
end
return p