Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(web): incorrect date reporting in graphs (#4747)

Elijah Potter76aeedee9d02
diff --git a/packages/web/src/lib/components/LineChart.svelte b/packages/web/src/lib/components/LineChart.svelte
index b3c73e513..07af42a12 100644
--- a/packages/web/src/lib/components/LineChart.svelte
+++ b/packages/web/src/lib/components/LineChart.svelte
@@ -11,7 +11,7 @@ import type { Point } from 'chart.js';
import Chart from 'chart.js/auto';
import { onMount } from 'svelte';
-/** Props for a single-series chart. Dates are displayed in the viewer's local timezone. */
+/** Props for a single-series chart. Dates are displayed in UTC. */
interface Props {
/** Observations in any order; defaults to empty. Invalid dates and nonfinite values are omitted. */
data?: TimeSeriesPoint[];
@@ -27,6 +27,7 @@ let points = $derived(toChartPoints(data));
const dateFormatter = new Intl.DateTimeFormat(undefined, {
dateStyle: 'short',
timeStyle: 'short',
+ timeZone: 'UTC',
});
/** Convert dates to milliseconds and sort chronologically without mutating input or merging duplicates. */
diff --git a/packages/web/src/routes/admin/ext-site-problems/[slug]/[domain]/+page.server.ts b/packages/web/src/routes/admin/ext-site-problems/[slug]/[domain]/+page.server.ts
index b56d77008..9175391d0 100644
--- a/packages/web/src/routes/admin/ext-site-problems/[slug]/[domain]/+page.server.ts
+++ b/packages/web/src/routes/admin/ext-site-problems/[slug]/[domain]/+page.server.ts
@@ -12,7 +12,7 @@ export const load: PageServerLoad = async ({ params }) => {
}
const end = new Date();
- end.setUTCHours(0, 0, 0, 0);
+ end.setUTCHours(24, 0, 0, 0);
const start = slug === 'all' ? null : new Date(end.getTime() - duration);
return {
diff --git a/packages/web/src/routes/admin/ext-uninstall-reasons/[slug]/[reason]/+page.server.ts b/packages/web/src/routes/admin/ext-uninstall-reasons/[slug]/[reason]/+page.server.ts
index 17c5ab4f8..e5d87760f 100644
--- a/packages/web/src/routes/admin/ext-uninstall-reasons/[slug]/[reason]/+page.server.ts
+++ b/packages/web/src/routes/admin/ext-uninstall-reasons/[slug]/[reason]/+page.server.ts
@@ -12,7 +12,7 @@ export const load: PageServerLoad = async ({ params }) => {
}
const end = new Date();
- end.setUTCHours(0, 0, 0, 0);
+ end.setUTCHours(24, 0, 0, 0);
const start = slug === 'all' ? null : new Date(end.getTime() - duration);
return {
diff --git a/packages/web/src/routes/admin/problematic-lints/[slug]/[lintId]/+page.server.ts b/packages/web/src/routes/admin/problematic-lints/[slug]/[lintId]/+page.server.ts
index f7ec19ab8..3eed48f75 100644
--- a/packages/web/src/routes/admin/problematic-lints/[slug]/[lintId]/+page.server.ts
+++ b/packages/web/src/routes/admin/problematic-lints/[slug]/[lintId]/+page.server.ts
@@ -4,7 +4,7 @@ import ProblematicLints from '$lib/db/models/ProblematicLints';
import type { PageServerLoad } from './$types';
/**
- * Load one lint ID's counts for complete UTC days, ending with yesterday.
+ * Load one lint ID's UTC daily counts, including today's partial total.
* All-time data starts at its first report's day and is empty if none exist.
*/
export const load: PageServerLoad = async ({ params }) => {
@@ -16,7 +16,7 @@ export const load: PageServerLoad = async ({ params }) => {
}
const end = new Date();
- end.setUTCHours(0, 0, 0, 0);
+ end.setUTCHours(24, 0, 0, 0);
const start = slug === 'all' ? null : new Date(end.getTime() - duration);
return {