hotfix: sort by date

This commit is contained in:
tangly1024
2023-06-29 23:26:06 +08:00
parent 11035f2cd7
commit 8103e23aac
3 changed files with 5 additions and 6 deletions

View File

@@ -45,9 +45,7 @@ export async function getAllPosts({ notionPageData, from, pageType }) {
// Sort by date
if (BLOG.POSTS_SORT_BY === 'date') {
posts.sort((a, b) => {
const dateA = new Date(a?.publishTime || a.createdTime)
const dateB = new Date(b?.publishTime || b.createdTime)
return dateB - dateA
return b?.sortDate - a?.sortDate
})
}
return posts