No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
end |
end |
||
− | return ( outdate .. "[[" .. cal[to]["name"] .. "|" .. to .. "]]" ) |
+ | return ( outdate .. " [[" .. cal[to]["name"] .. "|" .. to .. "]]" ) |
end |
end |
||
Revision as of 00:40, 16 May 2020
Documentation for this module may be created at Module:Date/doc
-- A script for Greyhawk calendar conversion.
local cal = {
["CY"] = { ahead=0, name="Common Year"},
["OL"] = { ahead=804, name="Olman Lunar"},
["OR"] = { ahead=644, name="Oeridian Record"},
["TC"] = { ahead=1407, name="Touv Calendar"},
["FT"] = { ahead=2150, name="Flan Tracking"},
["BH"] = { ahead=2659, name="Baklunish Hegira"},
["OC"] = { ahead=4462, name="Olven Calendar"},
["SD"] = { ahead=5515, name="Suloise Dating"}
}
local p = {}
function p.Date ( frame )
local year = tonumber(frame.args["year"]) or 1
local fr = frame.args["from"] or "CY"
local to = frame.args["to"] or "CY"
local outdate = cal[to]["ahead"]-cal[fr]["ahead"]
-- Special handling of crossing zero line due to lack of year zero
if year <= 0 and outdate >= 0 then
outdate = outdate + 1
elseif year >= 0 and outdate <= 0 then
outdate = outdate - 1
end
return ( outdate .. " [[" .. cal[to]["name"] .. "|" .. to .. "]]" )
end
return p