diff --git a/src/pages/index.astro b/src/pages/index.astro index cc24f8b5..7a6ea92b 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -3,7 +3,9 @@ import { getCollection } from 'astro:content'; import Layout from '../layouts/Layout.astro'; const posts = (await getCollection('posts')).sort((a,b) => { - return new Date(b.data.publishedAt) - new Date(a.data.publishedAt); + const bPublishedAt = new Date(b.data.publishedAt); + const aPublishedAt = new Date(a.data.publishedAt); + return bPublishedAt.getTime() - aPublishedAt.getTime(); }); ---