diff --git a/app/[slug]/page.tsx b/app/[slug]/page.tsx index 5d2c418..90accad 100644 --- a/app/[slug]/page.tsx +++ b/app/[slug]/page.tsx @@ -26,7 +26,7 @@ export default async function Post({ params: { slug } }: { params: { slug: strin return ( <>
- {post.date.toLocaleDateString()} + {post.date.toLocaleDateString('en-US', { timeZone: 'UTC' })}

{post.title}

{post.subtitle}

diff --git a/app/page.tsx b/app/page.tsx index 43133fd..8847280 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -28,7 +28,7 @@ export default async function Index() { )}

{post.title}

- {post.date.toLocaleDateString()} + {post.date.toLocaleDateString('en-US', { timeZone: 'UTC' })}

{post.subtitle}

diff --git a/utils/post.ts b/utils/post.ts index 1abfc6e..e2cbe79 100644 --- a/utils/post.ts +++ b/utils/post.ts @@ -45,9 +45,12 @@ export async function loadSinglePage(slug: string): Promise { if (!data.title) return null; + const [year, month, day] = postMatch.groups?.date.split('-') || [] + const date = new Date(Date.UTC(parseInt(year), parseInt(month) - 1, parseInt(day))) + return { slug: postMatch.groups?.slug || '', - date: new Date(postMatch.groups?.date || ''), + date, title: data.title, subtitle: data.subtitle, unlisted: typeof data.unlisted === 'boolean' ? data.unlisted : false,