From 15031c7224b46c2da94878ecf7be0fe88a264a4d Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Tue, 5 Nov 2024 08:58:36 +0000 Subject: [PATCH] Use UTC times consistently for daily classifications --- .../DailyClassificationsChartContainer.js | 2 +- .../stores/User/UserPersonalization/YourStats/YourStats.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app-project/src/screens/ClassifyPage/components/YourStats/components/DailyClassificationsChart/DailyClassificationsChartContainer.js b/packages/app-project/src/screens/ClassifyPage/components/YourStats/components/DailyClassificationsChart/DailyClassificationsChartContainer.js index c950b9e9796..ad2f92bae83 100644 --- a/packages/app-project/src/screens/ClassifyPage/components/YourStats/components/DailyClassificationsChart/DailyClassificationsChartContainer.js +++ b/packages/app-project/src/screens/ClassifyPage/components/YourStats/components/DailyClassificationsChart/DailyClassificationsChartContainer.js @@ -17,7 +17,7 @@ function DailyClassificationsChartContainer({ const [year, monthIndex, date] = period.split('-') const utcDay = Date.UTC(year, monthIndex - 1, date) const day = new Date(utcDay) - const isToday = day.getUTCDay() === TODAY.getDay() + const isToday = day.getUTCDay() === TODAY.getUTCDay() const count = isToday ? counts.today : statsCount const longLabel = day.toLocaleDateString(locale, { timeZone: 'UTC', weekday: 'long' }) const alt = `${longLabel}: ${count}` diff --git a/packages/app-project/stores/User/UserPersonalization/YourStats/YourStats.js b/packages/app-project/stores/User/UserPersonalization/YourStats/YourStats.js index 3e635e00ff0..07309362b5c 100644 --- a/packages/app-project/stores/User/UserPersonalization/YourStats/YourStats.js +++ b/packages/app-project/stores/User/UserPersonalization/YourStats/YourStats.js @@ -80,7 +80,7 @@ const YourStats = types weekDay.setUTCDate(newDate) const period = weekDay.toISOString().substring(0, 10) const { count } = dailyCounts.find(count => count.period.startsWith(period)) || { count: 0, period } - const dayNumber = weekDay.getDay() + const dayNumber = weekDay.getUTCDay() weeklyStats.push({ count, dayNumber,