fix dates of news

This commit is contained in:
ariari04 2024-09-03 10:58:38 +06:00
parent d1440f3907
commit ea58e4f2d1

View File

@ -7,16 +7,10 @@ import message from "./icons/message.svg";
import calendar from "./icons/calendar.svg";
import ReviewSection from "@/widgets/ReviewSection/ReviewSection";
const NewsDetails = async ({
params,
}: {
params: { id: string };
}) => {
const NewsDetails = async ({ params }: { params: { id: string } }) => {
const getNewsById = async () => {
const response = await apiInstance.get<INews>(
`/news/${params.id}/`
);
const response = await apiInstance.get<INews>(`/news/${params.id}/`);
console.log(response);
return response.data;
};
@ -48,9 +42,9 @@ const NewsDetails = async ({
<Image src={calendar} alt="Calendar Icon" />
<p>
{months[data.created_at.slice(5, 7)]}{" "}
{data.created_at.slice(5, 7).slice(0, 1) === "0"
? data.created_at.slice(6, 7)
: data.created_at.slice(5, 7)}
{data.created_at.slice(8, 10) === "0"
? data.created_at.slice(9, 10)
: data.created_at.slice(8, 10)}
, {data.created_at.slice(0, 4)}
</p>
</div>