Module:Date Stuff: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}
function p.main(frame)
local orgiArgs = frame:getParent().args
local args = {}
for k, v in pairs(orgiArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
if args[1] == "date" then
return p.date(args)
elseif args[1] == "age" then
return p.age(args)
end
end


--Splits a string based on specified delimiter
--Splits a string based on specified delimiter
Line 51: Line 67:


--Converts a short from date to a long from date using the specified calendar
--Converts a short from date to a long from date using the specified calendar
function p.date(frame)
function p.date(args)
   return writeDate(convertShortDate(frame:getParent().args[1], frame:getParent().args[2]))
   return writeDate(convertShortDate(args[2], args[3]))
end
end