From 693979cbd2972a2e30c94bb7790d75e5bfdf8f7e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Jan 2025 01:42:52 -0500 Subject: [PATCH] Fix Date Bugggggggggggggggggggggggggggggggggggggggg --- commands/commit-count.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/commands/commit-count.js b/commands/commit-count.js index f2cd7d8..025487d 100644 --- a/commands/commit-count.js +++ b/commands/commit-count.js @@ -112,7 +112,23 @@ module.exports = { } } - messageMap = new Map([...messageMap.entries()].sort((a, b) => a - b)); + messageMap = new Map([...messageMap.entries()].sort((a, b) => { + if (a[1] == b[1]) { + if (b > a) { + return -1; + } + else if (a < b) { + return 1; + } + return 0; + } + else if (a[1] < b[1]) { + return -1; + } + else { + return 1; + } + })); // Start Commit Checking let validString = ''; @@ -204,7 +220,7 @@ module.exports = { if (validDays.includes(formattedDay)) { dayMap.set(formattedDay, true); } - else if (formattedDay != (monthName + ' ' + (new Date()).getDate().toString().padStart(2, 0))) { + else if (formattedDay != (monthName + ' ' + (new Date()).getDate().toString())) { invalidString += `${formattedDay}\n`; dayMap.set(formattedDay, false); }