From 94da2091e72ad87b37d38cb4bc503f106067d3de Mon Sep 17 00:00:00 2001 From: seaHi Date: Thu, 16 Jul 2026 19:32:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=B8=83=E5=B1=80=E4=B8=8E=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/+page.server.ts | 18 ++++++++++++------ src/routes/+page.svelte | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index a805862..12cf580 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -11,14 +11,14 @@ export const load: PageServerLoad = async ({ platform }) => { id: 1, title: 'Hello, BlogFlare! (Fallback)', excerpt: 'This is my first post on BlogFlare. Welcome to my new blog powered by SvelteKit.', - date: '2026-07-12', + date: 'Jul 12, 2026', slug: 'hello-world' }, { id: 2, title: 'The Beauty of Typecho Theme VOID', excerpt: 'VOID is a minimalist, typography-oriented theme that brings elegance to your reading experience.', - date: '2026-07-11', + date: 'Jul 11, 2026', slug: 'beauty-of-void' } ] @@ -33,10 +33,16 @@ export const load: PageServerLoad = async ({ platform }) => { ).all(); // Convert date to string for serialization - const formattedPosts = results.map(post => ({ - ...post, - date: new Date(post.date as string).toLocaleDateString() - })); + const formattedPosts = results.map(post => { + const d = new Date(post.date as string); + const month = d.toLocaleString('en-US', { month: 'short' }); + const day = d.getDate(); + const year = d.getFullYear(); + return { + ...post, + date: `${month} ${day}, ${year}` + }; + }); return { posts: formattedPosts diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a0cc74b..a5fabf9 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -6,17 +6,17 @@
{#each data.posts as post} - + {/each}