diff --git a/src/components/GiteaActivity.astro b/src/components/GiteaActivity.astro index 8bbe41a..2a20b52 100644 --- a/src/components/GiteaActivity.astro +++ b/src/components/GiteaActivity.astro @@ -76,7 +76,7 @@ function summarizeActivity(item: GiteaActivityData['recent'][number]) { } } -const recentActivities = activity.recent.slice(0, 3).map(summarizeActivity); +const recentActivities = activity.recent.slice(0, 4).map(summarizeActivity); const isPlaceholder = activity.source === 'placeholder'; --- diff --git a/src/components/LogCard.astro b/src/components/LogCard.astro index 90e1c92..81c11b3 100644 --- a/src/components/LogCard.astro +++ b/src/components/LogCard.astro @@ -1,4 +1,6 @@ --- +import { formatDate } from '../utils/datetime'; + interface Props { slug: string; title: string; @@ -9,11 +11,7 @@ interface Props { } const { slug, title, date, repo, summary, tags } = Astro.props; -const formattedDate = date.toLocaleDateString('zh-CN', { - year: 'numeric', - month: '2-digit', - day: '2-digit', -}); +const formattedDate = formatDate(date); ---
diff --git a/src/pages/logs/[slug].astro b/src/pages/logs/[slug].astro index 786a9aa..315ed8a 100644 --- a/src/pages/logs/[slug].astro +++ b/src/pages/logs/[slug].astro @@ -2,6 +2,7 @@ import { getCollection, render } from 'astro:content'; import Layout from '../../layouts/Layout.astro'; import { site } from '../../config'; +import { formatDate } from '../../utils/datetime'; export async function getStaticPaths() { const logs = await getCollection('logs'); @@ -14,11 +15,7 @@ export async function getStaticPaths() { const { log } = Astro.props; const { Content } = await render(log); -const formattedDate = log.data.date.toLocaleDateString('zh-CN', { - year: 'numeric', - month: '2-digit', - day: '2-digit', -}); +const formattedDate = formatDate(log.data.date); --- Date.parse(value)).filter((value) => !Number.isNaN(value)); if (timestamps.length === 0) {