Module:BassaridianCalendar: Difference between revisions
From MicrasWiki
Jump to navigationJump to search
NewZimiaGov (talk | contribs) No edit summary |
NewZimiaGov (talk | contribs) No edit summary |
||
| Line 6: | Line 6: | ||
local secondsInDay = 24 * 60 * 60 -- Number of seconds in a day | local secondsInDay = 24 * 60 * 60 -- Number of seconds in a day | ||
local daysPerYear = 183 | local daysPerYear = 183 | ||
-- Current date | -- Current date | ||
| Line 15: | Line 12: | ||
-- Calculate PSSC year and day | -- Calculate PSSC year and day | ||
local psscYear = math.floor( | local yearFraction = totalDaysElapsed / daysPerYear | ||
local dayOfYear = ( | local psscYear = math.floor(yearFraction) | ||
local dayOfYear = math.floor((yearFraction - psscYear) * daysPerYear) + 1 | |||
-- Determine month and day within the month | -- Determine month and day within the month | ||
local month, dayInMonth, zodiac | local month, dayInMonth, zodiac | ||
if dayOfYear <= | if dayOfYear <= 61 then | ||
month = "Atosiel" | month = "Atosiel" | ||
dayInMonth = dayOfYear | dayInMonth = dayOfYear | ||
| Line 34: | Line 32: | ||
zodiac = "Indomin" | zodiac = "Indomin" | ||
end | end | ||
elseif dayOfYear <= | elseif dayOfYear <= 122 then | ||
month = "Thalassiel" | month = "Thalassiel" | ||
dayInMonth = dayOfYear - | dayInMonth = dayOfYear - 61 | ||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = "Chrysen" | zodiac = "Chrysen" | ||
| Line 50: | Line 48: | ||
else | else | ||
month = "Opsitheiel" | month = "Opsitheiel" | ||
dayInMonth = dayOfYear - | dayInMonth = dayOfYear - 122 | ||
if dayInMonth <= 12 then | if dayInMonth <= 12 then | ||
zodiac = "Opsithia" | zodiac = "Opsithia" | ||
| Line 88: | Line 86: | ||
-- Return the formatted date | -- Return the formatted date | ||
return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. psscYear .. " PSSC – " .. event | return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. (psscYear + 50) .. " PSSC – " .. event | ||
end | end | ||
return p | return p | ||
Revision as of 02:41, 11 December 2024
Documentation for this module may be created at Module:BassaridianCalendar/doc
local p = {}
function p.getCurrentDate()
-- Constants
local startDate = os.time({year = 1999, month = 8, day = 6}) -- August 6, 1999
local secondsInDay = 24 * 60 * 60 -- Number of seconds in a day
local daysPerYear = 183
-- Current date
local currentDate = os.time()
local totalDaysElapsed = math.floor((currentDate - startDate) / secondsInDay)
-- Calculate PSSC year and day
local yearFraction = totalDaysElapsed / daysPerYear
local psscYear = math.floor(yearFraction)
local dayOfYear = math.floor((yearFraction - psscYear) * daysPerYear) + 1
-- Determine month and day within the month
local month, dayInMonth, zodiac
if dayOfYear <= 61 then
month = "Atosiel"
dayInMonth = dayOfYear
if dayInMonth <= 12 then
zodiac = "Atosien"
elseif dayInMonth <= 24 then
zodiac = "Eosena"
elseif dayInMonth <= 36 then
zodiac = "Micrasha"
elseif dayInMonth <= 48 then
zodiac = "Pyreska"
else
zodiac = "Indomin"
end
elseif dayOfYear <= 122 then
month = "Thalassiel"
dayInMonth = dayOfYear - 61
if dayInMonth <= 12 then
zodiac = "Chrysen"
elseif dayInMonth <= 24 then
zodiac = "Thalassian"
elseif dayInMonth <= 36 then
zodiac = "Nephelia"
elseif dayInMonth <= 48 then
zodiac = "Glinaeus"
else
zodiac = "Noctien"
end
else
month = "Opsitheiel"
dayInMonth = dayOfYear - 122
if dayInMonth <= 12 then
zodiac = "Opsithia"
elseif dayInMonth <= 24 then
zodiac = "Stygian"
elseif dayInMonth <= 36 then
zodiac = "Faunian"
elseif dayInMonth <= 48 then
zodiac = "Silenian"
else
zodiac = "Catosien"
end
end
-- Event lookup table
local events = {
["Atosiel,6"] = "Bayram al-Nur (Festival of Light)",
["Atosiel,18"] = "Chag Or Hadash (Festival of New Light)",
["Atosiel,30"] = "Symposion Eirinis (Symposium of Harmony)",
["Atosiel,43"] = "Alev Günü (Day of Flame)",
["Atosiel,55"] = "Tikkun Tzel (Repair of Shadows)",
["Thalassiel,67"] = "Panegyris Chrysou (Golden Gathering)",
["Thalassiel,80"] = "Mehtap Dalgası (Moonlit Tide)",
["Thalassiel,92"] = "Oneiro Foteino (Dream of Illumination)",
["Thalassiel,105"] = "Erev Galgal (Eve of Cycles)",
["Thalassiel,115"] = "Leilat al-Kamar (Night of the Moon)",
["Opsitheiel,128"] = "Chag Tvuah (Festival of Harvest)",
["Opsitheiel,140"] = "Anagenesis Eirmos (Procession of Rebirth)",
["Opsitheiel,150"] = "Panagia Therizis (Holy Day of the Reaper)",
["Opsitheiel,165"] = "Karnavali Thysias (Carnival of Celebration)",
["Opsitheiel,175"] = "Sefar Yashar (Straight Path Celebration)"
}
-- Determine the event for the current day
local eventKey = month .. "," .. dayInMonth
local event = events[eventKey] or "No significant events today."
-- Return the formatted date
return dayOfYear .. ", " .. month .. " (" .. zodiac .. "), " .. (psscYear + 50) .. " PSSC – " .. event
end
return p