Skip to content

Commit

Permalink
Use momentJS date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lisamburns committed Feb 22, 2016
1 parent a3763fc commit 5f0f8df
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"keymirror": "^0.1.1",
"moment": "^2.11.2",
"object-assign": "^4.0.1",
"react": "^0.14.3",
"react-dom": "^0.14.3",
Expand Down Expand Up @@ -79,6 +80,6 @@
"build:doc": "doctoc --github --title \"## Contents\" ./"
},
"pre-commit": [
"test"
"test"
]
}
5 changes: 3 additions & 2 deletions src/js/components/Ballot/PositionItem.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component, PropTypes } from "react";
import { Link } from "react-router";
import PositionStore from "../../stores/PositionStore";
import Formatter from "../../utils/formatter";
const moment = require('moment');

export default class PositionItem extends Component {
static propTypes = {
Expand Down Expand Up @@ -30,7 +30,8 @@ export default class PositionItem extends Component {
render () {
var position = this.state.position;
var supportText = position.is_oppose ? "Opposes" : "Supports";
var dateText = Formatter.formatDate(this.props.last_updated);
var dateStr = this.props.last_updated;
var dateText = moment(dateStr).startOf('day').fromNow();

return <div>
{/* One organization"s Position on this Candidate */}
Expand Down
14 changes: 0 additions & 14 deletions src/js/utils/formatter.js

This file was deleted.

0 comments on commit 5f0f8df

Please sign in to comment.