Module:Dates

months = { [1]={34,0,34,"Faneluin"}, [2]={25,34,59,"Anarlosse"}, [3]={34,59,93,"Edhealasse"}, [4]={32,93,125,"Rasaalu"}, [5]={31,125,156,"Anarkalina"}, [6]={33,156,189,"Urnulina"}, [7]={33,189,222,"Naurnaara"}, [8]={31,222,253,"Tyelcartel"}, [9]={30,253,283,"Ujeregula"}, [10]={32,283,315,"Eregamandil"}, [11]={31,315,346,"Moribel"}, [12]={30,346,376,"Randametta"} } function beautify (nmb,numb2) local ik = 0 repeat ik = ik + 1 nmb = nmb / numb2 until (nmb / numb2 < 1) nmb = nmb * numb2 ik = ik - 1 nmb = math.ceil(nmb * 2- 0.5) nmb = nmb / 2 * math.pow (numb2, ik) return nmb end function Months1(days) if days <= months[1][3] then return months[1][4] elseif days <= months[2][3] and days > months[1][3] then return months[2][4] elseif days <= months[3][3] and days > months[2][3] then return months[3][4] elseif days <= months[4][3] and days > months[3][3] then return months[4][4] elseif days <= months[5][3] and days > months[4][3] then return months[5][4] elseif days <= months[6][3] and days > months[5][3] then return months[6][4] elseif days <= months[7][3] and days > months[6][3] then return months[7][4] elseif days <= months[8][3] and days > months[7][3] then return months[8][4] elseif days <= months[9][3] and days > months[8][3] then return months[9][4] elseif days <= months[10][3] and days > months[9][3] then return months[10][4] elseif days <= months[11][3] and days > months[10][3] then return months[11][4] else return months[12][4] end end function Months2(days) if days <= months[1][3] then return 1 elseif days <= months[2][3] and days > months[1][3] then return 2 elseif days <= months[3][3] and days > months[2][3] then return 3 elseif days <= months[4][3] and days > months[3][3] then return 4 elseif days <= months[5][3] and days > months[4][3] then return 5 elseif days <= months[6][3] and days > months[5][3] then return 6 elseif days <= months[7][3] and days > months[6][3] then return 7 elseif days <= months[8][3] and days > months[7][3] then return 8 elseif days <= months[9][3] and days > months[8][3] then return 9 elseif days <= months[10][3] and days > months[9][3] then return 10 elseif days <= months[11][3] and days > months[10][3] then return 11 else return 12 end end function YearConvert1(TerranYears) return (TerranYears * 365.25) / 376 end function YearConvert2(ArtograchYears) return (ArtograchYears * 376) / 365.25 end function GetDays(years) local trueyears = YearConvert1(years) local small_years = math.fmod(trueyears,1) if small_years < 0 then small_years = small_years + 1 end if small_years == 0 then small_years = 0.002659574468 end local days1 = math.floor(small_years * 376) local month1 = Months1(days1) local month2 = Months2(days1) if month2 > 1 then days1 = days1 - months[month2-1][3] end return math.floor(trueyears), month1, days1 end function GetDate(getdays) local year,months,days = GetDays(getdays) local string = "0" if year == 0 then string = "" .. 0 .. " BEKE/AEKE" elseif year < 0 then string = "" .. (year * -1) .. " BEKE" elseif year > 0 then string = "" .. year .. " AEKE" end if days == 1 then string = string .. ", " .. days .. "st of " .. "" .. months .. " " elseif days == 2 then string = string .. ", " .. days .. "nd of " .. "" .. months .. " " else string = string .. ", " .. days .. "th of " .. "" .. months .. " " end return string end local p={} function p.main(frame) return GetDate(tonumber(frame.args[1])) end return p