Skip to content

Commit

Permalink
Merge pull request #1510 from tangly1024/fix/lastPostSort
Browse files Browse the repository at this point in the history
修复最新文章发布排序
  • Loading branch information
tangly1024 committed Sep 7, 2023
2 parents 141c3cd + 5535ebe commit fd859e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/notion/getNotionData.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function getLatestPosts({ allPages, from, latestPostCount }) {
const allPosts = allPages?.filter(page => page.type === 'Post' && page.status === 'Published')

const latestPosts = Object.create(allPosts).sort((a, b) => {
const dateA = new Date(a?.lastEditedDay || a?.publishDate)
const dateB = new Date(b?.lastEditedDay || b?.publishDate)
const dateA = new Date(a?.lastEditedDate || a?.publishDate)
const dateB = new Date(b?.lastEditedDate || b?.publishDate)
return dateB - dateA
})
return latestPosts.slice(0, latestPostCount)
Expand Down

0 comments on commit fd859e6

Please sign in to comment.