From c7cd16a637d0167f3fe5e4293e9c40f430f4b8bb Mon Sep 17 00:00:00 2001 From: shadcn Date: Thu, 7 Nov 2024 21:36:19 +0400 Subject: [PATCH] fix(www): interactive chart --- apps/www/lib/registry.ts | 2 +- .../www/registry/new-york/block/chart-area-interactive.tsx | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/www/lib/registry.ts b/apps/www/lib/registry.ts index 0a8abfa30c0..df277482901 100644 --- a/apps/www/lib/registry.ts +++ b/apps/www/lib/registry.ts @@ -18,7 +18,7 @@ export function getRegistryComponent( name: string, style: Style["name"] = DEFAULT_REGISTRY_STYLE ) { - return memoizedIndex[style][name].component + return memoizedIndex[style][name]?.component } export async function getRegistryItem( diff --git a/apps/www/registry/new-york/block/chart-area-interactive.tsx b/apps/www/registry/new-york/block/chart-area-interactive.tsx index 1cd672af11c..cd8e7e6b288 100644 --- a/apps/www/registry/new-york/block/chart-area-interactive.tsx +++ b/apps/www/registry/new-york/block/chart-area-interactive.tsx @@ -141,15 +141,16 @@ export default function Component() { const filteredData = chartData.filter((item) => { const date = new Date(item.date) - const now = new Date() + const referenceDate = new Date("2024-06-30") let daysToSubtract = 90 if (timeRange === "30d") { daysToSubtract = 30 } else if (timeRange === "7d") { daysToSubtract = 7 } - now.setDate(now.getDate() - daysToSubtract) - return date >= now + const startDate = new Date(referenceDate) + startDate.setDate(startDate.getDate() - daysToSubtract) + return date >= startDate }) return (