diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-08-17 13:26:39 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-08-17 13:26:39 +0200 |
commit | bb420a94eb3b35c61f276b66c91f3f17ca2b07e8 (patch) | |
tree | 5237d0410f7973fc1ebae7780efa61b74ec8dfb3 | |
parent | 584b6868b51e19f6524db61b35bc807737d91ef6 (diff) |
fix post sorting
-rw-r--r-- | pages/index.tsx | 5 |
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> |