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 ( <>
+ {/*
{articleDetail?.slug} -
+ */}AUTHOR
@@ -737,7 +760,7 @@ export default function DetailContent() {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",