Skip to content

Commit 8796d27

Browse files
committed
Enhance Tooltip labelFormatter for better handling (ref: gommzystudio#61; #4b18d31fc144b404b3a00905806cab0dc4a62b0f)
1 parent 83e2811 commit 8796d27

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

client/src/components/ContactCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,11 @@ export function ContactCard({
186186
<XAxis dataKey="timestamp" hide />
187187
<YAxis domain={['auto', 'auto']} />
188188
<Tooltip
189-
labelFormatter={(t: number) => new Date(t).toLocaleTimeString()}
189+
labelFormatter={(label) => {
190+
const t = typeof label === "number" ? label : Number(label);
191+
if (!Number.isFinite(t)) return String(label ?? "");
192+
return new Date(t).toLocaleTimeString();
193+
}}
190194
contentStyle={{ borderRadius: '8px', border: 'none', boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)' }}
191195
/>
192196
<Line type="monotone" dataKey="avg" stroke="#3b82f6" strokeWidth={2} dot={false} name="Avg RTT" isAnimationActive={false} />

0 commit comments

Comments
 (0)