From 4fb9f446e32ac56a419cb49fc62d83e5b5e88f86 Mon Sep 17 00:00:00 2001 From: Lupita Bot <263059171+lupita-hom@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:10:41 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20rename=20weekStart=20=E2=86=92=20date=20?= =?UTF-8?q?in=20demo=20to=20match=20synced=20CodeFrequencyChart=20from=20m?= =?UTF-8?q?ain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CodeFrequencyChart.tsx | 4 ++-- src/lib/github-api.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/CodeFrequencyChart.tsx b/src/components/CodeFrequencyChart.tsx index 6488a23..715084a 100644 --- a/src/components/CodeFrequencyChart.tsx +++ b/src/components/CodeFrequencyChart.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react'; import * as d3 from 'd3'; interface TimeSeriesPoint { - weekStart: string; + date: string; additions: number; deletions: number; commitCount: number; @@ -34,7 +34,7 @@ export default function CodeFrequencyChart({ data }: Props) { const parsed = data.map((d) => ({ ...d, - date: new Date(d.weekStart + 'T00:00:00Z'), + date: new Date(d.date + 'T00:00:00Z'), })); const maxVal = d3.max(parsed, (d) => Math.max(d.additions, d.deletions)) ?? 1; diff --git a/src/lib/github-api.ts b/src/lib/github-api.ts index b212200..4a760f6 100644 --- a/src/lib/github-api.ts +++ b/src/lib/github-api.ts @@ -109,7 +109,7 @@ export interface DirectoryStats { export interface CodeFrequencyData { timeSeries: Array<{ - weekStart: string; + date: string; additions: number; deletions: number; commitCount: number; @@ -462,7 +462,7 @@ export const api = { let timeSeries = (freqData ?? []) .filter((w) => w[1] !== 0 || w[2] !== 0) .map((w) => ({ - weekStart: new Date(w[0]! * 1000).toISOString().slice(0, 10), + date: new Date(w[0]! * 1000).toISOString().slice(0, 10), additions: w[1] ?? 0, deletions: Math.abs(w[2] ?? 0), commitCount: 0, @@ -473,7 +473,7 @@ export const api = { const since = options.since ? new Date(options.since) : null; const until = options.until ? new Date(options.until) : null; timeSeries = timeSeries.filter((p) => { - const d = new Date(p.weekStart); + const d = new Date(p.date); if (since && d < since) return false; if (until && d > until) return false; return true; @@ -498,8 +498,8 @@ export const api = { ); const period = { - since: timeSeries[0]?.weekStart ?? '', - until: timeSeries[timeSeries.length - 1]?.weekStart ?? '', + since: timeSeries[0]?.date ?? '', + until: timeSeries[timeSeries.length - 1]?.date ?? '', }; return {