Skip to content

Commit 6249d14

Browse files
committed
fix(blog): date formatting
1 parent d8b9ad1 commit 6249d14

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/routes/blog/+page.svelte

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import Header from '$components/base/Header.svelte';
44
import Seo from '$components/seo/Seo.svelte';
55
import type { PageData } from './$types';
6+
import { formatDate } from '$lib/util/html';
67
78
export let data: PageData;
89
</script>
@@ -19,13 +20,7 @@
1920
<!-- TODO: Make the below a component -->
2021
<div class="flex flex-col gap-3 py-9 md:py-0">
2122
<!-- Date -->
22-
<span
23-
>{new Date(post.metadata.date).toLocaleDateString('en-US', {
24-
year: 'numeric',
25-
month: 'long',
26-
day: 'numeric',
27-
})}</span
28-
>
23+
<span>{formatDate(new Date(data.metadata.date))}</span>
2924

3025
<!-- Title -->
3126
<h2 class="text-2xl font-bold">{post.metadata.title}</h2>

src/routes/blog/[slug]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<div class="flex grow flex-col gap-3 border-b border-b-white/[15%] py-9">
2121
<!-- Date -->
22-
<span>{formatDate(data.metadata.date)}</span>
22+
<span>{formatDate(new Date(data.metadata.date))}</span>
2323

2424
<!-- Title -->
2525
<h2 class="text-2xl font-bold">{data.metadata.title}</h2>

0 commit comments

Comments
 (0)