Unverified Commit 4cadb68d authored by Michael McQuade's avatar Michael McQuade Committed by GitHub

Return a number from sort compare function (#21763)

Changed the return values of the compare function from string values to numbers
parent 41b7c524
...@@ -38,6 +38,6 @@ export function getAllPosts(fields = []) { ...@@ -38,6 +38,6 @@ export function getAllPosts(fields = []) {
const posts = slugs const posts = slugs
.map((slug) => getPostBySlug(slug, fields)) .map((slug) => getPostBySlug(slug, fields))
// sort posts by date in descending order // sort posts by date in descending order
.sort((post1, post2) => (post1.date > post2.date ? '-1' : '1')) .sort((post1, post2) => (post1.date > post2.date ? -1 : 1))
return posts return posts
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment