Module:Today/GA
Documentation for this module may be created at Module:Today/GA/doc
------ IMPERIAL GALACTYAN CALENDAR ------
local M = {}
-- Define the number of months and days in each month
local numMonths = 10
local daysPerMonth = 59
-- Function to convert Gregorian date to 10-month calendar date
function M.convertTo10MonthCalendar(year, month, day)
year = tonumber(year)
month = tonumber(month)
day = tonumber(day)
return "Received: " .. tostring(year) .. " " .. tostring(month) .. " " .. tostring(day)
-- Perform calculations here to convert the date
--[[ local totalDays = (year - 1) * 365 + math.floor((year - 1) / 4) + day
local monthIndex = math.floor((totalDays - 1) / daysPerMonth) + 1
local dayInMonth = (totalDays - 1) % daysPerMonth + 1
return monthIndex, dayInMonth]]
end
-- Function to convert 10-month calendar date back to Gregorian date
function M.convertToGregorianCalendar(monthIndex, dayInMonth)
monthIndex = tonumber(monthIndex)
dayInMonth = tonumber(dayInMonth)
-- Perform calculations here to convert the date
local totalDays = (monthIndex - 1) * daysPerMonth + dayInMonth
local year = math.floor(totalDays / 365) + 1
local remainingDays = totalDays % 365
local leapYear = (year % 4 == 0)
if remainingDays > 59 and not leapYear then
remainingDays = remainingDays + 1
end
local month = math.ceil(remainingDays / 30)
local day = remainingDays % 30
if day == 0 then
day = 30
end
return year, month, day
end
-- Export the functions
return M