Skip to content

Commit

Permalink
used moment.js for date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ahorowitz123 committed Jul 23, 2018
1 parent 068ff11 commit 6350664
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"dependencies": {
"ajv": "^6.5.2",
"moment": "^2.22.2",
"react": "^16.4.1",
"react-bootstrap": "^0.32.1",
"react-dom": "^16.4.1",
Expand Down
4 changes: 4 additions & 0 deletions src/components/App/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
text-align: center;
}

.App th {
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
Expand Down
4 changes: 3 additions & 1 deletion src/components/MovieList/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import { Table } from "react-bootstrap";
import moment from "moment";

const MovieList = props =>
<Table responsive>
Expand All @@ -12,13 +13,14 @@ const MovieList = props =>
</thead>
<tbody>
{props.movies.map((movie, index) => {
const thisDate = moment(movie.release_date, "YYYY-MM-DD")
return (
<tr key={index}>
<td>
{movie.title}
</td>
<td>
{movie.release_date}
{thisDate.format("dddd, MMMM D YYYY")}
</td>
</tr>
);
Expand Down

0 comments on commit 6350664

Please sign in to comment.