Module:DhenluiCalendar

local p = {} --p stands for package local lenghtOfMonth = 32.658333333 local lenghtOfEclipse = 14.6

function p.timeOfGreatNight( month ) local monthBegins = math.floor(lenghtOfMonth * (month -1) + (lenghtOfEclipse/24) + 0.5) local dayOfEclipse = lenghtOfMonth * month local timeNightStarts = (dayOfEclipse % 1) * 24 local timeNightEnds = timeNightStarts + lenghtOfEclipse local lenghtOfNextDay = 12 - (timeNightEnds % 24) if (timeNightEnds%24) >= 12 then lenghtOfNextDay = 12 timeNightEnds = math.floor((timeNightEnds+12)/24)*24 end if timeNightStarts > 12 then timeNightStarts = 12 end local lenghtOfNight = timeNightEnds - timeNightStarts return lenghtOfNight end

return p