Module:Date Erache : Différence entre versions
Sauter à la navigation
Sauter à la recherche
(Une révision intermédiaire par le même utilisateur non affichée) | |||
Ligne 50 : | Ligne 50 : | ||
local daysOfWeek = {} | local daysOfWeek = {} | ||
− | daysOfWeek[ | + | daysOfWeek[0] = "Premui" |
− | daysOfWeek[ | + | daysOfWeek[1] = "Dezui" |
− | daysOfWeek[ | + | daysOfWeek[2] = "Tressui" |
− | daysOfWeek[ | + | daysOfWeek[3] = "Khatui" |
− | daysOfWeek[ | + | daysOfWeek[4] = "Quinui" |
− | daysOfWeek[ | + | daysOfWeek[5] = "Sizui" |
− | daysOfWeek[ | + | daysOfWeek[6] = "Sepui" |
− | daysOfWeek[ | + | daysOfWeek[7] = "Houi" |
− | local dayOfWeek = eracheDay% | + | local dayOfWeek = (eracheDay-1)%8 |
local dayOfWeekName = daysOfWeek[dayOfWeek] | local dayOfWeekName = daysOfWeek[dayOfWeek] | ||
Version actuelle datée du 11 octobre 2019 à 21:55
La documentation pour ce module peut être créée à Module:Date Erache/doc
local p = {} function p.dateErache() local year = os.date("%Y") local month = os.date("%m") local day = os.date("%d") local hour = os.date("%H") -- mw.log(year .. " " .. month .. " " .. day .. " " .. hour) -- Day 1 of Erache's calendar local dateOrigin = os.time{year=2010, month=11, day=9, hour = 0} -- Today local dateNow = os.time{year=year,month=month,day=day,hour=hour} -- Diff in IRL s local diff = dateNow - dateOrigin -- Diff in IRL days local diffDays = diff / (3600*24) -- mw.log("Original day is : " .. dateOrigin) -- mw.log("Today is : " .. dateNow ) -- mw.log("Diff is : " .. diff .. " s") -- mw.log("Diff is : ".. diffDays .." days") local eracheDays = math.floor(diffDays * 72) local eracheMonths = math.floor(eracheDays /64) local eracheYear = math.floor(eracheDays / 1024) local eracheMonth = eracheMonths%16+1 local months = {} months[1] = "Pampélune" months[2] = "Fifrelune" months[3] = "Mimélune" months[4] = "Claircelune" months[5] = "Mérolia" months[6] = "Cidélia" months[7] = "Iffélia" months[8] = "Lérolia" months[9] = "Holevent" months[10] = "Agrevent" months[11] = "Tercevent" months[12] = "Démévent" months[13] = "Radévard" months[14] = "Tronvard" months[15] = "Pénavard" months[16] = "Nérévard" local eracheMonthName = months[eracheMonth] local eracheDay = eracheDays%64+1 local daysOfWeek = {} daysOfWeek[0] = "Premui" daysOfWeek[1] = "Dezui" daysOfWeek[2] = "Tressui" daysOfWeek[3] = "Khatui" daysOfWeek[4] = "Quinui" daysOfWeek[5] = "Sizui" daysOfWeek[6] = "Sepui" daysOfWeek[7] = "Houi" local dayOfWeek = (eracheDay-1)%8 local dayOfWeekName = daysOfWeek[dayOfWeek] -- mw.log("Nous sommes le " .. dayOfWeekName .. " " .. eracheDay .. " " .. eracheMonthName .. " de l'an ".. eracheYear) return dayOfWeekName .. " " .. eracheDay .. " " .. eracheMonthName .. " de l'an ".. eracheYear end return p