aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-08-17 13:26:39 +0200
committerlonkaars <loek@pipeframe.xyz>2021-08-17 13:26:39 +0200
commitbb420a94eb3b35c61f276b66c91f3f17ca2b07e8 (patch)
tree5237d0410f7973fc1ebae7780efa61b74ec8dfb3
parent584b6868b51e19f6524db61b35bc807737d91ef6 (diff)
fix post sorting
-rw-r--r--pages/index.tsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/pages/index.tsx b/pages/index.tsx
index d2be08e..634950d 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -68,7 +68,10 @@ export default function Home(props: {
{index == 0 && <>
<h2>Recent posts</h2>
<div className='recentPosts'>
- {posts.posts.reverse().slice(0, 4).map(post => {
+ {posts.posts.sort((a, b) => (
+ new Date(a.date).getTime() -
+ new Date(b.date).getTime()
+ )).reverse().slice(0, 4).map(post => {
return <PostCard post={post} />;
})}
</div>