Skip to content

Commit

Permalink
Dates are pre-formatted GraphQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Aug 15, 2017
1 parent c3e5951 commit b6fb888
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 27 deletions.
5 changes: 2 additions & 3 deletions www/src/pages/blog/all.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Container from 'components/Container';
import Header from 'components/Header';
import React from 'react';
import {sharedStyles} from 'theme';
import dateToString from 'utils/dateToString';
import toCommaSeparatedList from 'utils/toCommaSeparatedList';

const AllBlogPosts = ({data}) => (
Expand All @@ -38,7 +37,7 @@ const AllBlogPosts = ({data}) => (
{' '}
on
{' '}
{dateToString(new Date(node.fields.date))}
{node.fields.date}
{' '}
by
{' '}
Expand Down Expand Up @@ -72,7 +71,7 @@ export const pageQuery = graphql`
}
}
fields {
date
date(formatString: "MMMM DD, YYYY")
slug
}
}
Expand Down
4 changes: 2 additions & 2 deletions www/src/templates/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const toSectionList = allMarkdownRemark => [
const Blog = ({data, location}) => (
<MarkdownPage
authors={data.markdownRemark.frontmatter.author}
date={new Date(data.markdownRemark.fields.date)}
date={data.markdownRemark.fields.date}
location={location}
markdownRemark={data.markdownRemark}
sectionList={toSectionList(data.allMarkdownRemark)}
Expand Down Expand Up @@ -62,7 +62,7 @@ export const pageQuery = graphql`
}
}
fields {
date
date(formatString: "MMMM DD, YYYY")
path
}
}
Expand Down
5 changes: 2 additions & 3 deletions www/src/templates/components/MarkdownPage/MarkdownPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {StickyContainer} from 'react-sticky';
import PropTypes from 'prop-types';
import React from 'react';
import StickySidebar from '../StickySidebar';
import dateToString from 'utils/dateToString';
import findSectionForPath from 'utils/findSectionForPath';
import toCommaSeparatedList from 'utils/toCommaSeparatedList';
import {sharedStyles} from 'theme';
Expand Down Expand Up @@ -62,7 +61,7 @@ const MarkdownPage = ({

{(date || hasAuthors) &&
<div css={{marginTop: 15}}>
{date ? `${dateToString(date)} ` : ''}
{date}{' '}
{hasAuthors &&
<span>
by {toCommaSeparatedList(authors, author => (
Expand Down Expand Up @@ -122,7 +121,7 @@ MarkdownPage.defaultProps = {
// TODO Better types
MarkdownPage.propTypes = {
authors: PropTypes.array.isRequired,
date: PropTypes.object,
date: PropTypes.string,
location: PropTypes.object.isRequired,
markdownRemark: PropTypes.object.isRequired,
sectionList: PropTypes.array.isRequired,
Expand Down
19 changes: 0 additions & 19 deletions www/src/utils/dateToString.js

This file was deleted.

0 comments on commit b6fb888

Please sign in to comment.