Skip to content

Commit 37b9056

Browse files
committed
fix: show correct date/time in timeline tooltip per range type
- Minutes range: shows HH:mm:ss - Hours range: shows HH:mm - Days range: shows MMM d, HH:mm (includes date)
1 parent 3ab4bb9 commit 37b9056

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

features/status/components/Timeline.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ export function Timeline({ checks, range }: TimelineProps) {
6565

6666
const now = useMemo(() => Date.now(), []);
6767

68+
const formatBucketTime = (ts: number) => {
69+
if (range.type === "minutes") return format(ts, "HH:mm:ss");
70+
if (range.type === "hours") return format(ts, "HH:mm");
71+
return format(ts, "MMM d, HH:mm");
72+
};
73+
6874
return (
6975
<div className="space-y-2">
7076
<div className="flex h-6 gap-0.5">
@@ -85,7 +91,7 @@ export function Timeline({ checks, range }: TimelineProps) {
8591
content: (
8692
<div className="text-xs">
8793
<div className="font-bold">{bucket.status === "good" ? "Healthy" : bucket.status === "bad" ? "Down" : "No Data"}</div>
88-
<div>{format(bucket.start, "HH:mm")} - {format(bucket.end, "HH:mm")}</div>
94+
<div>{formatBucketTime(bucket.start)} {formatBucketTime(bucket.end)}</div>
8995
</div>
9096
)
9197
});

0 commit comments

Comments
 (0)