Skip to content

Commit

Permalink
use moment to style timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-ships committed Aug 6, 2017
1 parent a39eac0 commit bc4a704
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"bulma": "^0.5.0",
"faker": "^4.1.0",
"moment": "^2.18.1",
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-dom": "^15.6.1"
Expand Down
11 changes: 6 additions & 5 deletions src/components/presentational/message-list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Messages from '../container/messages'
import moment from 'moment'
import PropTypes from 'prop-types'
import React from 'react'

Expand Down Expand Up @@ -37,13 +38,13 @@ function MessageList({ ids, messagesById, postMessage }) {
return (
<li className="message is-dark is-small" key={`message-${id}`}>
<div className="message-body">
<div>
<p className="is-size-6">
{text}
</div>
</p>

<div>
{new Date(timestamp).toString()}
</div>
<p className="is-size-7">
{moment(timestamp).format('MMM D, YYYY, h:mm:ss a')}
</p>

<div>
<Messages
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4123,6 +4123,10 @@ [email protected], [email protected], "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi
dependencies:
minimist "0.0.8"

moment@^2.18.1:
version "2.18.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down

0 comments on commit bc4a704

Please sign in to comment.