Module:Date Stuff: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
local p = {}
local p = {}


function p.main(frame)
function p.date(frame)
local orgiArgs = frame:getParent().args
local orgiArgs = frame:getParent().args
local args = {}
local args = {}
Line 10: Line 10:
end
end
end
end
if args[1] == "date" then
return p._date(args)
return p.date(args)
end
elseif args[1] == "age" then
 
return p.age(args)
function p.age(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
end
return p._age(args)
end
end


Line 67: Line 75:


--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(args)
function p._date(args)
   return writeDate(convertShortDate(args[2], args[3]))
   return writeDate(convertShortDate(args[1], args[2]))
end
end




--Calculates a persons age using the specified calendar
--Calculates a persons age using the specified calendar
function p.age(frame)
function p._age(frame)
   firstDate = frame:getParent().args[1]
   firstDate = frame:getParent().args[1]
   secondDate = frame:getParent().args[2]
   secondDate = frame:getParent().args[2]

Navigation menu