Module:Today/GA: Difference between revisions
Jump to navigation
Jump to search
Im a waffle1 (talk | contribs) (Lua!!!!!!1!) |
Im a waffle1 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
------ IMPERIAL GALACTYAN CALENDAR ------ | ------ IMPERIAL GALACTYAN CALENDAR ------ | ||
local M = {} | |||
-- Define the number of months and days in each month | -- Define the number of months and days in each month | ||
Line 6: | Line 8: | ||
-- Function to convert Gregorian date to 10-month calendar date | -- Function to convert Gregorian date to 10-month calendar date | ||
function convertTo10MonthCalendar(year, month, day) | function M.convertTo10MonthCalendar(year, month, day) | ||
-- Perform calculations here to convert the date | -- Perform calculations here to convert the date | ||
local totalDays = (year - 1) * 365 + math.floor((year - 1) / 4) + day | local totalDays = (year - 1) * 365 + math.floor((year - 1) / 4) + day | ||
Line 16: | Line 18: | ||
-- Function to convert 10-month calendar date back to Gregorian date | -- Function to convert 10-month calendar date back to Gregorian date | ||
function convertToGregorianCalendar(monthIndex, dayInMonth) | function M.convertToGregorianCalendar(monthIndex, dayInMonth) | ||
-- Perform calculations here to convert the date | -- Perform calculations here to convert the date | ||
local totalDays = (monthIndex - 1) * daysPerMonth + dayInMonth | local totalDays = (monthIndex - 1) * daysPerMonth + dayInMonth | ||
Line 37: | Line 39: | ||
-- Export the functions | -- Export the functions | ||
return | return M | ||
Revision as of 19:39, 11 August 2023
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)
-- 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)
-- 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