Skip to content

Commit

Permalink
fix: use a smarter way to do dates sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
rnmeow committed Jan 22, 2024
1 parent 9991c6f commit eeb3c97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/api/posts.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export default defineEventHandler(async () => {
tags: i.tags
})
}
return posts.sort((a, b) => !dayjs(a.datetime).isAfter(dayjs(b.datetime)) ? 1 : -1)
return posts.sort((a, b) => dayjs(a.datetime).isBefore(dayjs(b.datetime)) ? 1 : -1)
})

0 comments on commit eeb3c97

Please sign in to comment.