fix production TypeScript date formatting

This commit is contained in:
mr.sabri
2026-07-22 07:10:30 +03:30
parent 18f84bfd41
commit 55ba2df7b6
2 changed files with 21 additions and 24 deletions
+12 -15
View File
@@ -12,6 +12,7 @@ import {
ChartTooltip, ChartTooltip,
ChartTooltipContent, ChartTooltipContent,
} from "@/components/ui/chart"; } from "@/components/ui/chart";
import { formatDateLabel } from "@/lib/to-date-input";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
interface Hero242Props { interface Hero242Props {
@@ -143,29 +144,25 @@ const Hero242 = ({ className }: Hero242Props) => {
axisLine={false} axisLine={false}
tickMargin={8} tickMargin={8}
minTickGap={32} minTickGap={32}
tickFormatter={(value) => { tickFormatter={(value) =>
const date = new Date(value); formatDateLabel(value, "en-US", {
return date.toLocaleDateString("en-US", {
month: "short", month: "short",
day: "numeric", day: "numeric",
}); })
}} }
/> />
<ChartTooltip <ChartTooltip
content={ content={
<ChartTooltipContent <ChartTooltipContent
className="w-[150px]" className="w-[150px]"
nameKey="views" nameKey="views"
labelFormatter={(value) => { labelFormatter={(value) =>
return new Date(String(value)).toLocaleDateString( formatDateLabel(value, "en-US", {
"en-US", month: "short",
{ day: "numeric",
month: "short", year: "numeric",
day: "numeric", })
year: "numeric", }
}
);
}}
/> />
} }
/> />
+9 -9
View File
@@ -10,6 +10,7 @@ import {
ChartTooltip, ChartTooltip,
ChartTooltipContent, ChartTooltipContent,
} from "@/components/ui/chart"; } from "@/components/ui/chart";
import { formatDateLabel } from "@/lib/to-date-input";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
const bgPattern = { const bgPattern = {
@@ -118,26 +119,25 @@ const Hero246 = ({ className }: Hero246Props) => {
axisLine={false} axisLine={false}
tickMargin={8} tickMargin={8}
minTickGap={32} minTickGap={32}
tickFormatter={(value) => { tickFormatter={(value) =>
const date = new Date(value); formatDateLabel(value, "fa-IR", {
return date.toLocaleDateString("fa-IR", {
month: "short", month: "short",
day: "numeric", day: "numeric",
}); })
}} }
/> />
<ChartTooltip <ChartTooltip
content={ content={
<ChartTooltipContent <ChartTooltipContent
className="w-[150px]" className="w-[150px]"
nameKey="views" nameKey="views"
labelFormatter={(value) => { labelFormatter={(value) =>
return new Date(value).toLocaleDateString("fa-IR", { formatDateLabel(value, "fa-IR", {
month: "short", month: "short",
day: "numeric", day: "numeric",
year: "numeric", year: "numeric",
}); })
}} }
/> />
} }
/> />