Format dates properly

This commit is contained in:
Kamran Ahmed
2019-11-06 23:08:39 +04:00
parent 09309dfef7
commit f188ef4296
5 changed files with 23 additions and 14 deletions

View File

@@ -1,4 +1,6 @@
import Link from 'next/link';
import formatDate from 'date-fns/format'
import { Author, AuthorImage, AuthorName, BlockLink, BlockMeta, BlockSubtitle, BlockTitle, PublishDate } from './style';
import { findByUsername } from 'lib/author';
@@ -15,7 +17,7 @@ const GuideBlock = ({ guide }) => {
<AuthorImage src={ author.picture } />
<AuthorName>{ author.name }</AuthorName>
</Author>
<PublishDate>{ guide.updatedAt }</PublishDate>
<PublishDate>{ formatDate(new Date(guide.createdAt), 'MMMM d, yyyy') }</PublishDate>
</BlockMeta>
</BlockLink>
</Link>