Skip to content

Commit

Permalink
Avoid bugs with native Date class (#12098)
Browse files Browse the repository at this point in the history
  • Loading branch information
qWici authored Apr 22, 2020
1 parent 47d7edd commit 39d9476
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { parseISO, format } from 'date-fns'

export default function Date({ dateString }) {
export default function DateFormater({ dateString }) {
const date = parseISO(dateString)
return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time>
}
4 changes: 2 additions & 2 deletions examples/blog-starter/components/hero-post.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Avatar from '../components/avatar'
import Date from '../components/date'
import DateFormater from '../components/date-formater'
import CoverImage from '../components/cover-image'
import Link from 'next/link'

Expand All @@ -24,7 +24,7 @@ export default function HeroPost({
</Link>
</h3>
<div className="mb-4 md:mb-0 text-lg">
<Date dateString={date} />
<DateFormater dateString={date} />
</div>
</div>
<div>
Expand Down
4 changes: 2 additions & 2 deletions examples/blog-starter/components/post-header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Avatar from '../components/avatar'
import Date from '../components/date'
import DateFormater from '../components/date-formater'
import CoverImage from '../components/cover-image'
import PostTitle from '../components/post-title'

Expand All @@ -18,7 +18,7 @@ export default function PostHeader({ title, coverImage, date, author }) {
<Avatar name={author.name} picture={author.picture} />
</div>
<div className="mb-6 text-lg">
<Date dateString={date} />
<DateFormater dateString={date} />
</div>
</div>
</>
Expand Down
4 changes: 2 additions & 2 deletions examples/blog-starter/components/post-preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Avatar from '../components/avatar'
import Date from '../components/date'
import DateFormater from '../components/date-formater'
import CoverImage from './cover-image'
import Link from 'next/link'

Expand All @@ -22,7 +22,7 @@ export default function PostPreview({
</Link>
</h3>
<div className="text-lg mb-4">
<Date dateString={date} />
<DateFormater dateString={date} />
</div>
<p className="text-lg leading-relaxed mb-4">{excerpt}</p>
<Avatar name={author.name} picture={author.picture} />
Expand Down

0 comments on commit 39d9476

Please sign in to comment.