From afb4648394a0a5a25b95053041a5b7203435c14b Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Thu, 28 Sep 2023 17:08:59 +0100 Subject: [PATCH] [*] account for lua retardation --- .../detail/use-version-write-prjver-run.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Features/detail/use-version-write-prjver-run.lua b/Features/detail/use-version-write-prjver-run.lua index 56cd659..fbb234f 100644 --- a/Features/detail/use-version-write-prjver-run.lua +++ b/Features/detail/use-version-write-prjver-run.lua @@ -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()