Skip to content

Commit 522811b

Browse files
gskrilclaude
andcommitted
Fix Invalid Date in chart tooltip
Read timestamp directly from the data payload instead of relying on the labelFormatter's first argument, which passes a config label string rather than the raw timestamp value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b4e7aa6 commit 522811b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

client/src/screens/Home.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ export function Home() {
141141
<XAxis
142142
dataKey="timestamp"
143143
type="number"
144-
scale="time"
145144
domain={['dataMin', 'dataMax']}
146145
tickLine={false}
147146
axisLine={false}
@@ -167,9 +166,10 @@ export function Home() {
167166
content={
168167
<ChartTooltipContent
169168
indicator="dot"
170-
labelFormatter={(value) => {
171-
const date = new Date(value)
172-
return date.toLocaleDateString('en-US', {
169+
labelFormatter={(_value, payload) => {
170+
const timestamp = payload?.[0]?.payload?.timestamp
171+
if (!timestamp) return ''
172+
return new Date(timestamp).toLocaleDateString('en-US', {
173173
month: 'short',
174174
day: 'numeric',
175175
hour: 'numeric',

0 commit comments

Comments
 (0)