Module:KnightspireDate
From Knightspire Wiki
Documentation for this module may be created at Module:KnightspireDate/doc
local p = {}
local epoch = os.time({
year = 2026,
month = 5,
day = 1,
hour = 0
})
function p.loreYear(frame)
local input = frame.args[1]
if not input or input == "" then
return ""
end
local year, month, day = input:match("(%d+)%-(%d+)%-(%d+)")
if not year then
return "Invalid date"
end
local founded = os.time({
year = tonumber(year),
month = tonumber(month),
day = tonumber(day),
hour = 0
})
local diff = founded - epoch
local weeks = math.floor(diff / 604800)
return "Year " .. tostring(weeks + 1)
end
return p