diff --git a/components/details/details-content.tsx b/components/details/details-content.tsx index 38f1737..47020d3 100644 --- a/components/details/details-content.tsx +++ b/components/details/details-content.tsx @@ -86,7 +86,7 @@ export default function DetailContent() { const [diseId, setDiseId] = useState(0); const [thumbnailImg, setThumbnailImg] = useState([]); const [selectedMainImage, setSelectedMainImage] = useState( - 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() { - - {new Date( - articleDetail?.publishedAt ?? articleDetail?.createdAt - ).toLocaleDateString("id-ID", { + {new Date( + articleDetail?.publishedAt ?? articleDetail?.publishedAt, + ) + .toLocaleString("id-ID", { day: "numeric", month: "long", year: "numeric", - })} - + hour: "2-digit", + minute: "2-digit", + hour12: false, + timeZone: "Asia/Jakarta", + }) + .replace("pukul ", "")}{" "} + WIB + {articleDetail?.categories?.[0]?.title} @@ -527,7 +533,7 @@ export default function DetailContent() {
diff --git a/components/landing-page/header.tsx b/components/landing-page/header.tsx index 8c95c45..d6b713b 100644 --- a/components/landing-page/header.tsx +++ b/components/landing-page/header.tsx @@ -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() { /> {" "} - {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

diff --git a/components/landing-page/latest-and-popular.tsx b/components/landing-page/latest-and-popular.tsx index 1ea0358..5174e7f 100644 --- a/components/landing-page/latest-and-popular.tsx +++ b/components/landing-page/latest-and-popular.tsx @@ -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 (
@@ -301,14 +302,18 @@ export default function LatestandPopular() { /> {" "} - {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 {" "} - {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

@@ -452,14 +461,18 @@ export default function LatestandPopular() { /> {" "} - {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

diff --git a/components/landing-page/latest.tsx b/components/landing-page/latest.tsx index 4146871..f412a84 100644 --- a/components/landing-page/latest.tsx +++ b/components/landing-page/latest.tsx @@ -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 }) { /> {" "} - {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

@@ -325,14 +330,18 @@ export default function Latest({ id }: { id: number }) { /> {" "} - {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

@@ -373,14 +382,18 @@ export default function Latest({ id }: { id: number }) { /> {" "} - {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

@@ -420,14 +433,18 @@ export default function Latest({ id }: { id: number }) { /> {" "} - {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

@@ -502,14 +519,18 @@ export default function Latest({ id }: { id: number }) { /> {" "} - {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 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() { {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 @@ -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) => (