Skip to content

Commit

Permalink
fix(www): interactive chart
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn committed Nov 7, 2024
1 parent eff1918 commit c7cd16a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/www/lib/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions apps/www/registry/new-york/block/chart-area-interactive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit c7cd16a

Please sign in to comment.