diff --git a/app/lib/get-social-data.js b/app/lib/get-social-data.js index 3481d0e3f4..49d73895e0 100644 --- a/app/lib/get-social-data.js +++ b/app/lib/get-social-data.js @@ -20,7 +20,7 @@ function parseFeedPost(post) { id: post.ID, title: removeEntities(post.title), excerpt: removeEntities(post.excerpt), - created_at: post.date, + created_at: new Date(post.date), link: post.URL, image: post.featured_image }; @@ -59,7 +59,9 @@ async function getBlogPosts() { feeds.forEach(feed => { posts = posts.concat(feed.slice(0,3)) }); - return posts.map(parseFeedPost); + return posts + .map(parseFeedPost) + .sort((a,b) => b.created_at - a.created_at); } catch (error) { console.error(error); } diff --git a/app/pages/home-common/social.jsx b/app/pages/home-common/social.jsx index 5dd4b13ad3..279cc42f21 100644 --- a/app/pages/home-common/social.jsx +++ b/app/pages/home-common/social.jsx @@ -65,7 +65,7 @@ export default class HomePageSocial extends React.Component { 'home-social__blog-section--white': i === 0, 'home-social__blog-section--gray': i !== 0 }); - const timestamp = moment(new Date(post.created_at)).fromNow(); + const timestamp = moment(post.created_at).fromNow(); return (