diff --git a/components/details/details-content.tsx b/components/details/details-content.tsx index c1b64b5..421ce68 100644 --- a/components/details/details-content.tsx +++ b/components/details/details-content.tsx @@ -30,6 +30,7 @@ type Article = { description: string; categoryName: string; createdAt: string; + publishedAt: string; slug: string; createdByName: string; customCreatorName: string; @@ -278,6 +279,23 @@ export default function DetailContent() { ); } + function decodeHtmlString(raw: string = "") { + if (!raw) return ""; + + // 1️⃣ Hapus newline escape, backslash, dsb + let decoded = raw + .replace(/\\n/g, "\n") + .replace(/\\"/g, '"') // ubah \" jadi " + .replace(/\\'/g, "'") // ubah \' jadi ' + .replace(/\\\\/g, "\\") // ubah \\ jadi \ + .trim(); + + // 2️⃣ Decode entity HTML (misal ") + const el = document.createElement("textarea"); + el.innerHTML = decoded; + return el.value; + } + return ( <>
@@ -479,9 +497,9 @@ export default function DetailContent() {
-

+ {/*

{articleDetail?.slug} -

+

*/}
@@ -489,8 +507,13 @@ export default function DetailContent() { {/* Mikulnews.com - */} - - {articleDetail?.description} +

AUTHOR

@@ -737,7 +760,7 @@ export default function DetailContent() {
📅{" "} - {new Date(article.createdAt).toLocaleDateString( + {new Date(article.publishedAt).toLocaleDateString( "id-ID", { day: "2-digit", diff --git a/components/landing-page/headers-economy.tsx b/components/landing-page/headers-economy.tsx index baa9a5a..567ab4f 100644 --- a/components/landing-page/headers-economy.tsx +++ b/components/landing-page/headers-economy.tsx @@ -12,6 +12,7 @@ type Article = { categoryName: string; slug: string; createdAt: string; + publishedAt: string; createdByName: string; thumbnailUrl: string; categories: { title: string }[]; @@ -93,11 +94,14 @@ export default function HeaderEkonomi() {

By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} + {new Date(article.publishedAt).toLocaleDateString( + "en-US", + { + month: "long", + day: "numeric", + year: "numeric", + } + )}

- {new Date(post.createdAt).toLocaleDateString("en-US", { + {new Date(post.publishedAt).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", diff --git a/components/landing-page/headers-health.tsx b/components/landing-page/headers-health.tsx index 1f2c973..5df440c 100644 --- a/components/landing-page/headers-health.tsx +++ b/components/landing-page/headers-health.tsx @@ -12,6 +12,8 @@ type Article = { categoryName: string; slug: string; createdAt: string; + + publishedAt: string; createdByName: string; thumbnailUrl: string; categories: { title: string }[]; @@ -92,11 +94,14 @@ export default function HeaderHealth() {

By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} + {new Date(article.publishedAt).toLocaleDateString( + "en-US", + { + month: "long", + day: "numeric", + year: "numeric", + } + )}

- {new Date(post.createdAt).toLocaleDateString("en-US", { + {new Date(post.publishedAt).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", diff --git a/components/landing-page/headers-narrative.tsx b/components/landing-page/headers-narrative.tsx index 9935f48..ba764e3 100644 --- a/components/landing-page/headers-narrative.tsx +++ b/components/landing-page/headers-narrative.tsx @@ -12,6 +12,7 @@ type Article = { slug: string; categoryName: string; createdAt: string; + publishedAt: string; createdByName: string; thumbnailUrl: string; categories: { title: string }[]; @@ -92,11 +93,14 @@ export default function HeaderNarrative() {

By {article.createdByName} —{" "} - {new Date(article.createdAt).toLocaleDateString("en-US", { - month: "long", - day: "numeric", - year: "numeric", - })} + {new Date(article.publishedAt).toLocaleDateString( + "en-US", + { + month: "long", + day: "numeric", + year: "numeric", + } + )}

- {new Date(post.createdAt).toLocaleDateString("en-US", { + {new Date(post.publishedAt).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", diff --git a/components/landing-page/headers.tsx b/components/landing-page/headers.tsx index 1652a85..5971327 100644 --- a/components/landing-page/headers.tsx +++ b/components/landing-page/headers.tsx @@ -13,6 +13,7 @@ type Article = { categoryName: string; slug: string; createdAt: string; + publishedAt: string; createdByName: string; thumbnailUrl: string; categories: { @@ -93,7 +94,7 @@ export default function Beranda() {

- {new Date(item.createdAt).toLocaleDateString("id-ID", { + {new Date(item.publishedAt).toLocaleDateString("id-ID", { day: "2-digit", month: "long", year: "numeric", diff --git a/components/landing-page/more-news.tsx b/components/landing-page/more-news.tsx index 10ff286..9ffef4e 100644 --- a/components/landing-page/more-news.tsx +++ b/components/landing-page/more-news.tsx @@ -12,6 +12,7 @@ type Article = { description: string; categoryName: string; createdAt: string; + publishedAt: string; createdByName: string; slug: string; thumbnailUrl: string; @@ -126,7 +127,13 @@ const MoreNews = () => {

- {item.createdAt} + + {new Date(item?.publishedAt).toLocaleDateString("id-ID", { + day: "numeric", + month: "long", + year: "numeric", + })} +

diff --git a/components/landing-page/news.tsx b/components/landing-page/news.tsx index 2ec18d0..fdd86a1 100644 --- a/components/landing-page/news.tsx +++ b/components/landing-page/news.tsx @@ -174,6 +174,7 @@ type Article = { description: string; categoryName: string; createdAt: string; + publishedAt: string; createdByName: string; slug: string; customCreatorName: string; @@ -313,7 +314,7 @@ export default function News() {
- {new Date(item.createdAt).toLocaleDateString("id-ID", { + {new Date(item.publishedAt).toLocaleDateString("id-ID", { day: "2-digit", month: "long", year: "numeric", @@ -344,7 +345,14 @@ export default function News() {
- {item.createdAt} + + {" "} + {new Date(item.publishedAt).toLocaleDateString("id-ID", { + day: "2-digit", + month: "long", + year: "numeric", + })} +
@@ -434,7 +442,7 @@ export default function News() { {new Date( - articles[0]?.createdAt || "" + articles[0]?.publishedAt || "" ).toLocaleDateString("id-ID", { day: "2-digit", month: "long", @@ -481,7 +489,16 @@ export default function News() { BY ADMIN - {item.createdAt} + + {new Date(item?.publishedAt || "").toLocaleDateString( + "id-ID", + { + day: "2-digit", + month: "long", + year: "numeric", + } + )} +
@@ -561,7 +578,16 @@ export default function News() { - {post.createdAt} + + {new Date(post?.publishedAt || "").toLocaleDateString( + "id-ID", + { + day: "2-digit", + month: "long", + year: "numeric", + } + )} + {/* {post.comments} */}0 @@ -637,7 +663,16 @@ export default function News() { - {post.createdAt} + + {new Date(post?.publishedAt || "").toLocaleDateString( + "id-ID", + { + day: "2-digit", + month: "long", + year: "numeric", + } + )} + {/* {post.comments} */}0 diff --git a/components/landing-page/travel-news.tsx b/components/landing-page/travel-news.tsx index 8d3508f..e48a551 100644 --- a/components/landing-page/travel-news.tsx +++ b/components/landing-page/travel-news.tsx @@ -11,6 +11,7 @@ type Article = { description: string; categoryName: string; createdAt: string; + publishedAt: string; createdByName: string; thumbnailUrl: string; slug: string; @@ -134,7 +135,7 @@ const TravelNews = () => { {item.title}

- {new Date(item.createdAt).toLocaleDateString("id-ID", { + {new Date(item.publishedAt).toLocaleDateString("id-ID", { day: "2-digit", month: "long", year: "numeric",