[*] account for lua retardation

This commit is contained in:
Reece Wilson 2023-09-28 17:08:59 +01:00
parent af12c8ac8c
commit afb4648394

View File

@ -1,17 +1,22 @@
local function GetSnapshotName(full)
local strYear = os.date("%y")
local strMon = os.date("%m")
local iWeekOffset = tonumber(os.date("%w")) - 1
local iDayOffset = tonumber(os.date("%d"))
local iWeekIdxOffset = math.floor(iDayOffset / 7)
local bWeekTest = iWeekOffset > 2
local iWeekdayOffset = tonumber(os.date("%w"))
local iMonthOffset = tonumber(os.date("%d"))
if (iWeekdayOffset == 0) then iWeekdayOffset = 6
else iWeekdayOffset = iWeekdayOffset - 1 end -- "b-but muh iso 8601" fuck off. I like me some sanely formatted date codes like anyone else, but Sunday is apart of the weekEND.
-- global homo[-alist]s and uncritically thinking karens seethe.
-- you know it's the retards advocating for this when they start fucking up the lua indexing pattern of starting at one
local iWeekIdxOffset = math.floor((iMonthOffset - iWeekdayOffset) / 7)
if (iWeekIdxOffset < 0) then iWeekIdxOffset = 0 end
local bWeekTest = iWeekdayOffset > 2
local cWeekBase = "A"
if (bWeekTest) then cWeekBase = "a" else cWeekBase = "A" end
if (iWeekIdxOffset > 4) then iWeekIdxOffset = 4 end
if (iWeekIdxOffset > 3) then iWeekIdxOffset = 3 end
local cWeekChar = string.char(string.byte(cWeekBase) + iWeekIdxOffset)
if (not full) then strYear = strYear:sub(2, 2) end
return strYear .. strMon .. cWeekChar
return strYear .. strMon .. cWeekChar
-- N unalignedWeekOfTheMonth weekAlignedDayOfTheWeek (truncated to Aa - Dd)
end
local function DoAction()