Skip to content

Commit c206aa7

Browse files
committed
fix: derive tracker "days ago" label from the pill count
The left label shows how far back the chart reaches. It was computed from the oldest pill's date against the current time and rounded to whole days, so the same chart could read "45 days ago" or "44 days ago" depending on when you looked. The chart always renders a fixed number of pills, so the label now reflects that count and stays constant.
1 parent 37b3314 commit c206aa7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/ui/src/components/blocks/status-component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from "@openstatus/ui/components/ui/tooltip";
1010
import { useMediaQuery } from "@openstatus/ui/hooks/use-media-query";
1111
import { cn } from "@openstatus/ui/lib/utils";
12-
import { formatDistanceToNowStrict } from "date-fns";
12+
import { formatDistanceToNowStrict, subDays } from "date-fns";
1313
import { InfoIcon } from "lucide-react";
1414
import { useState } from "react";
1515
import { StatusIcon as UnifiedStatusIcon } from "@openstatus/ui/components/blocks/status-icon";
@@ -420,7 +420,7 @@ export function StatusComponentFooter({
420420
{isLoading ? (
421421
<Skeleton className="h-3 w-18" />
422422
) : data.length > 0 ? (
423-
formatDistanceToNowStrict(new Date(data[0].day), {
423+
formatDistanceToNowStrict(subDays(new Date(), data.length), {
424424
unit: "day",
425425
addSuffix: true,
426426
})

0 commit comments

Comments
 (0)