From 7ee6480a8cdc27c0a15e0c91a87d8da64348dc9f Mon Sep 17 00:00:00 2001 From: GreenAsJade Date: Sun, 22 Dec 2024 14:48:32 +1030 Subject: [PATCH] Use library start of week, and set it the same as we're using in graphs --- .../ReportsCenter/ReportsCenterCMDashboard.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/views/ReportsCenter/ReportsCenterCMDashboard.tsx b/src/views/ReportsCenter/ReportsCenterCMDashboard.tsx index d9fdb4afe0..104f09f796 100644 --- a/src/views/ReportsCenter/ReportsCenterCMDashboard.tsx +++ b/src/views/ReportsCenter/ReportsCenterCMDashboard.tsx @@ -60,11 +60,7 @@ interface IndividualCMVotingOutcomeData { } function startOfWeek(the_date: Date): Date { - const date = new Date(the_date); - const day = date.getDay(); // Get current day of week (0 is Sunday) - const diff = date.getDate() - day; // Calculate difference to the start of the week - - return new Date(date.setDate(diff)); + return startOfWeekDateFns(the_date, { weekStartsOn: 1 }); // 1 = Monday } // Hardcoding the vertical axis of all "report count" graphs as the total number helps convey @@ -562,7 +558,7 @@ export function ReportsCenterCMDashboard(): JSX.Element { My Votes - {/* A CM's Summary Pie Charts */} + {/* My Summary: A CM's Summary Pie Charts */}
{pgettext( @@ -583,7 +579,7 @@ export function ReportsCenterCMDashboard(): JSX.Element { - {/* The overall CM voting outcomes */} + {/* Group Outcomes: The overall CM voting outcomes */} {vote_data ? ["overall", "escaping", "stalling", "score_cheating"].map((report_type) => ( @@ -602,7 +598,7 @@ export function ReportsCenterCMDashboard(): JSX.Element { : "loading..."} - {/* Moderator view of each CM's vote categories */} + {/* Individual Votes: Moderator view of each CM's vote categories */} - {/* A CM's individual vote categories (My Votes) */} + {/* My Votes: A CM's individual vote categories */} {users_data ? ["overall", "escaping", "stalling", "score_cheating"].map((report_type) => (