Skip to content

Commit

Permalink
fix(dashboard): silence hydration mismatch warning in audit bucket row
Browse files Browse the repository at this point in the history
Revert static datetime formatting using `date-fns` to `toLocaleDateString()` to better suit global users. Suppress the hydration mismatch warnings caused by differences between server and client-side rendered dates.

Co-authored-by: @chronark
PR: #2413
  • Loading branch information
unrenamed committed Oct 20, 2024
1 parent 7f764d4 commit ba0c64a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions apps/dashboard/app/(app)/audit/[bucket]/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Badge } from "@/components/ui/badge";
import { Code } from "@/components/ui/code";
import { TableCell, TableRow } from "@/components/ui/table";
import { cn } from "@/lib/utils";
import { format } from "date-fns";
import { ChevronDown, KeySquare, Minus } from "lucide-react";
import { useState } from "react";

Expand Down Expand Up @@ -85,11 +84,11 @@ export const Row: React.FC<Props> = ({ auditLog, user }) => {
</TableCell>
<TableCell>
<div className="flex items-center gap-2">
<span className="text-sm text-content">
{format(new Date(auditLog.time), "dd/MM/yyyy")}
<span className="text-sm text-content" suppressHydrationWarning>
{new Date(auditLog.time).toLocaleDateString()}
</span>
<span className="text-xs text-content-subtle">
{format(new Date(auditLog.time), "dd/MM/yyyy")}
<span className="text-xs text-content-subtle" suppressHydrationWarning>
{new Date(auditLog.time).toLocaleDateString()}
</span>
</div>
</TableCell>
Expand Down

0 comments on commit ba0c64a

Please sign in to comment.