Skip to content

Commit d427c82

Browse files
committed
fix: Use user timezone's time in uptime table.
1 parent 8f1ba5d commit d427c82

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

apps/dashboard/app/(main)/websites/[id]/pulse/_components/recent-activity.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import {
66
XCircleIcon,
77
} from "@phosphor-icons/react";
88
import dayjs from "dayjs";
9+
import timezone from "dayjs/plugin/timezone";
10+
import utc from "dayjs/plugin/utc";
911
import { Badge } from "@/components/ui/badge";
1012
import {
1113
Table,
@@ -17,6 +19,9 @@ import {
1719
} from "@/components/ui/table";
1820
import { cn } from "@/lib/utils";
1921

22+
dayjs.extend(utc);
23+
dayjs.extend(timezone);
24+
2025
type Check = {
2126
timestamp: string;
2227
status: number; // 1 = up, 0 = down, 2 = pending
@@ -123,7 +128,9 @@ export function RecentActivity({ checks, isLoading }: RecentActivityProps) {
123128
</div>
124129
</TableCell>
125130
<TableCell className="text-center text-muted-foreground text-xs">
126-
{dayjs(check.timestamp).format("MMM D, HH:mm:ss")}
131+
{dayjs.utc(check.timestamp)
132+
.tz(dayjs.tz.guess())
133+
.format("MMM D, HH:mm:ss")}
127134
</TableCell>
128135
<TableCell className="text-center text-muted-foreground text-xs">
129136
<Badge className="font-mono text-[10px]" variant="outline">

0 commit comments

Comments
 (0)