From f52e901e0fc866df6a9b7f9d677db7e678dcd846 Mon Sep 17 00:00:00 2001 From: Adela Almasan Date: Tue, 1 Jul 2025 18:48:17 -0500 Subject: [PATCH] convert to timestamp --- .../plugins/panel/state-timeline/StateTimelineTooltip2.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/state-timeline/StateTimelineTooltip2.tsx b/public/app/plugins/panel/state-timeline/StateTimelineTooltip2.tsx index c6c7b3d20c2..ce0dc1d3af2 100644 --- a/public/app/plugins/panel/state-timeline/StateTimelineTooltip2.tsx +++ b/public/app/plugins/panel/state-timeline/StateTimelineTooltip2.tsx @@ -56,11 +56,14 @@ export const StateTimelineTooltip2 = ({ nextStateTs = xField.values[nextStateIdx!]; } - const stateTs = xField.values[dataIdx!]; + let stateTs = xField.values[dataIdx!]; + stateTs = typeof stateTs === 'number' ? stateTs : new Date(stateTs).valueOf(); + let duration: string; if (nextStateTs) { - duration = nextStateTs && fmtDuration(nextStateTs - stateTs); + nextStateTs = typeof nextStateTs === 'number' ? nextStateTs : new Date(nextStateTs).valueOf(); + duration = fmtDuration(nextStateTs - stateTs); endTime = nextStateTs; } else { const to = timeRange.to.valueOf();