Skip to content

Commit

Permalink
fix: πŸ› fix date bug in markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Reese committed Oct 15, 2020
1 parent 9bd6613 commit 3756799
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/markdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ const plugin = {
}

// if there is a date in frontmatter, sort them by most recent
const haveDates = plugin.markdown[route].reduce((out, cv) => cv.frontmatter && cv.frontmatter.date && out);
const haveDates = plugin.markdown[route].reduce(
(out, cv) => out && !!cv.frontmatter && !!cv.frontmatter.date,
true,
);

if (haveDates) {
plugin.markdown[route] = plugin.markdown[route].sort(
(a, b) => new Date(b.frontmatter.date) - new Date(a.frontmatter.date),
Expand Down

0 comments on commit 3756799

Please sign in to comment.