Skip to content

Commit

Permalink
Merge pull request #53 from casper-network/related-news-sorting
Browse files Browse the repository at this point in the history
MODIFIED: sorting changed for related news, as requested
  • Loading branch information
sd-ditoy authored Aug 30, 2023
2 parents 457f614 + d221b61 commit f12418f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/views/news/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default {
const intersection = availableCategories.filter((e) => articleCategories.includes(e));
return o.id !== currentId && intersection.length > 0;
})
.sort(() => ((Math.random() > 0.5) ? 1 : -1))
.sort((a, b) => (new Date(b.publish_date) - new Date(a.publish_date)))
.slice(1, 3);
},
//----------------------------------
Expand Down

0 comments on commit f12418f

Please sign in to comment.