Module:KnightspireDate: Difference between revisions
From Knightspire Wiki
Jump to navigationJump to search
Content deleted Content added
No edit summary |
No edit summary Tag: Reverted |
||
| Line 32: | Line 32: | ||
local weeks = math.floor(diff / 604800) |
local weeks = math.floor(diff / 604800) |
||
return |
return tostring(weeks + 1) |
||
end |
end |
||
Revision as of 05:51, 9 May 2026
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 tostring(weeks + 1)
end
return p