Module:Date Stuff: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 84: Line 84:
--Calculates a persons age using the specified calendar
--Calculates a persons age using the specified calendar
function p._age(args)
function p._age(args)
   birthDate = args[1]
   birthDate = convertShortDate(args[1], args[4])
   secondDate = args[2]
   secondDate = convertShortDate(args[2], args[4])
   status = args[3]
   status = args[3]
  calendar = args[4]
  --checks if birthDate is not nil, and if it is returns the second date
  if birthDate ~= nil then
    birthDate = convertShortDate(birthDate, calendar)
    secondDate = convertShortDate(secondDate, calendar)
  elseif birthDate == nil then
    return writeDate(convertShortDate(secondDate))
  end
    
    
   --Checks which math formula to use, based on how much of the date there is.
   --Checks which math formula to use, based on how much of the date there is.
Line 121: Line 113:
   --Determines if age or aged is required
   --Determines if age or aged is required
   if status == "alive" then
   if status == "alive" then
     return writeDate(birthDate)
     return writeDate(birthDate).." (age "..age..")"
   elseif status == "dead" then
   elseif status == "dead" then
     return writeDate(secondDate).." (aged "..age..")"
     return writeDate(secondDate).." (aged "..age..")"

Navigation menu