fix production TypeScript date formatting
This commit is contained in:
+12
-15
@@ -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
@@ -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",
|
||||||
});
|
})
|
||||||
}}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user