Skip to content

Commit a8d2e8d

Browse files
committed
fixing the dates
1 parent 39077f4 commit a8d2e8d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/pages/[slug]/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import mdxComponents from '@/components/mdxComponents';
22
import { EditDialogStyles } from '@/styles/EditDialogStyles.module.css';
33
import { postMeta } from '@/styles/PostMeta.module.css';
4+
import { format } from 'date-fns';
45
import { IoLogoGithub } from 'react-icons/io';
56
import type { PageProps } from 'waku/router';
67
import { unstable_notFound as notFound } from 'waku/router/server';
@@ -26,6 +27,7 @@ export default async function BlogPost(props: BlogPostPageProps) {
2627
const { default: MDXContent } = post;
2728
const editURL = `https://github.com/wesbos/wesbos/tree/master/${post.filePath}`;
2829
const image = post.images?.[0];
30+
const postDate = new Date(post.frontmatter.date);
2931

3032
return (
3133
<>
@@ -34,7 +36,7 @@ export default async function BlogPost(props: BlogPostPageProps) {
3436
<div>
3537
<H>{post.frontmatter.title}</H>
3638
<div className={postMeta}>
37-
<time dateTime={post.frontmatter.date}>{post.frontmatter.date}</time>
39+
<time dateTime={postDate.toISOString()}>{format(postDate, 'MMMM d, yyyy')}</time>
3840

3941
<span>{post.frontmatter.category.join(', ')}</span>
4042
<a rel="noopener noreferrer" target="_blank" href={editURL}>
@@ -52,7 +54,7 @@ export default async function BlogPost(props: BlogPostPageProps) {
5254
</a>
5355
</p>
5456
</div>
55-
<ContentNav prev={prev} next={next} />
57+
<ContentNav {...(prev ? { prev } : {})} {...(next ? { next } : {})} />
5658
</>
5759
);
5860
}

0 commit comments

Comments
 (0)