import type { TooltipContentProps } from "recharts"; interface ChartTooltipExtraProps { valuePrefix?: string; valueSuffix?: string; } type Props = Partial> & ChartTooltipExtraProps; export function ChartTooltip({ active, payload, label, valuePrefix = "", valueSuffix = "", }: Props) { if (!active || !payload?.length) return null; const dateStr = typeof label === "string" ? new Date(label + "T00:00:00").toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", }) : String(label); return (
{dateStr}
{payload.map((entry, i) => (
{valuePrefix} {typeof entry.value === "number" ? entry.value.toLocaleString() : entry.value} {valueSuffix}
))}
); }