fix:update publishedAt detail
This commit is contained in:
parent
b287069d30
commit
1b8ef91a72
|
|
@ -86,7 +86,7 @@ export default function DetailContent() {
|
|||
const [diseId, setDiseId] = useState(0);
|
||||
const [thumbnailImg, setThumbnailImg] = useState<File[]>([]);
|
||||
const [selectedMainImage, setSelectedMainImage] = useState<number | null>(
|
||||
null
|
||||
null,
|
||||
);
|
||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ export default function DetailContent() {
|
|||
|
||||
// 3️⃣ FILTER sesuai articleId
|
||||
const filteredFiles = allFiles.filter(
|
||||
(file: any) => file.articleId === data.id
|
||||
(file: any) => file.articleId === data.id,
|
||||
);
|
||||
|
||||
setDetailFiles(filteredFiles);
|
||||
|
|
@ -397,16 +397,22 @@ export default function DetailContent() {
|
|||
</span>
|
||||
<span>•</span>
|
||||
<span>
|
||||
<span>
|
||||
{new Date(
|
||||
articleDetail?.publishedAt ?? articleDetail?.createdAt
|
||||
).toLocaleDateString("id-ID", {
|
||||
{new Date(
|
||||
articleDetail?.publishedAt ?? articleDetail?.publishedAt,
|
||||
)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</span>
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</span>
|
||||
|
||||
<span>•</span>
|
||||
<span>{articleDetail?.categories?.[0]?.title}</span>
|
||||
</div>
|
||||
|
|
@ -527,7 +533,7 @@ export default function DetailContent() {
|
|||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: decodeHtmlString(
|
||||
articleDetail?.htmlDescription || ""
|
||||
articleDetail?.htmlDescription || "",
|
||||
),
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ type Article = {
|
|||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
publishedAt: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
createdByName: string;
|
||||
|
|
@ -155,14 +156,18 @@ export default function HeroNewsSection() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0].createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0].publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ type Article = {
|
|||
title: string;
|
||||
description: string;
|
||||
categoryName: string;
|
||||
publishedAt: string;
|
||||
createdAt: string;
|
||||
createdByName: string;
|
||||
slug: string;
|
||||
|
|
@ -239,7 +240,7 @@ export default function LatestandPopular() {
|
|||
const startIndex = (currentPage - 1) * ITEMS_PER_PAGE;
|
||||
const currentArticles = articles.slice(
|
||||
startIndex,
|
||||
startIndex + ITEMS_PER_PAGE
|
||||
startIndex + ITEMS_PER_PAGE,
|
||||
);
|
||||
return (
|
||||
<section className="bg-white py-10 px-4 md:px-10 w-full">
|
||||
|
|
@ -301,14 +302,18 @@ export default function LatestandPopular() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(article?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(article?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="h-4 w-4"
|
||||
|
|
@ -401,14 +406,18 @@ export default function LatestandPopular() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -452,14 +461,18 @@ export default function LatestandPopular() {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ type Article = {
|
|||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
publishedAt: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
slug: string;
|
||||
|
|
@ -278,14 +279,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -325,14 +330,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -373,14 +382,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -420,14 +433,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
@ -502,14 +519,18 @@ export default function Latest({ id }: { id: number }) {
|
|||
/>
|
||||
</g>
|
||||
</svg>{" "}
|
||||
{new Date(articles[0]?.createdAt).toLocaleDateString(
|
||||
"id-ID",
|
||||
{
|
||||
{new Date(articles[0]?.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
}
|
||||
)}
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="h-4 w-4"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ type postsData = {
|
|||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
publishedAt: string;
|
||||
categoryName: string;
|
||||
createdAt: string;
|
||||
slug: string;
|
||||
|
|
@ -118,8 +119,8 @@ export default function Beranda() {
|
|||
{posts
|
||||
.filter((post) =>
|
||||
post.categories?.some(
|
||||
(category) => category.title.toLowerCase() === "pembangunan"
|
||||
)
|
||||
(category) => category.title.toLowerCase() === "pembangunan",
|
||||
),
|
||||
)
|
||||
.slice(0, 6) // Ambil 4 artikel pertama setelah difilter
|
||||
.map((post, index) => (
|
||||
|
|
@ -150,11 +151,18 @@ export default function Beranda() {
|
|||
<Clock className="w-3 h-3" />
|
||||
<span>
|
||||
{post?.customCreatorName || post.createdByName} -{" "}
|
||||
{new Date(post.createdAt).toLocaleDateString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
{new Date(post.publishedAt)
|
||||
.toLocaleString("id-ID", {
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
timeZone: "Asia/Jakarta",
|
||||
})
|
||||
.replace("pukul ", "")}{" "}
|
||||
WIB
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -207,8 +215,8 @@ export default function Beranda() {
|
|||
{posts
|
||||
.filter((post) =>
|
||||
post.categories?.some(
|
||||
(category) => category.title.toLowerCase() === "kesehatan"
|
||||
)
|
||||
(category) => category.title.toLowerCase() === "kesehatan",
|
||||
),
|
||||
)
|
||||
.slice(0, 6) // Ambil 4 artikel pertama setelah difilter
|
||||
.map((post, index) => (
|
||||
|
|
|
|||
Loading…
Reference in New Issue