调整文章日期显示

This commit is contained in:
tangly1024.com
2023-06-29 12:44:46 +08:00
parent d07a145029
commit 9ac2bbb180
31 changed files with 61 additions and 67 deletions

View File

@@ -45,8 +45,8 @@ 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?.date?.start_date || a.createdTime)
const dateB = new Date(b?.date?.start_date || b.createdTime)
const dateA = new Date(a?.publishTime || a.createdTime)
const dateB = new Date(b?.publishTime || b.createdTime)
return dateB - dateA
})
}