mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Merge pull request #17 from ascribe/AD-1259-All-dates-showing-up-as-2014
Replace Javascript's Date object with momentjs
This commit is contained in:
commit
c852eaf143
@ -41,6 +41,7 @@ For this project, we're using:
|
||||
* We don't use ES6's class declaration for React components because it does not support Mixins as well as Autobinding ([Blog post about it](http://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#autobinding))
|
||||
* We don't use camel case for file naming but in everything Javascript related
|
||||
* We use `let` instead of `var`: [SA Post](http://stackoverflow.com/questions/762011/javascript-let-keyword-vs-var-keyword)
|
||||
* We don't use Javascript's `Date` object, as its interface introduced bugs previously and we're including `momentjs` for other dependencies anyways
|
||||
|
||||
Branch names
|
||||
=====================
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Moment from 'moment';
|
||||
|
||||
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
|
||||
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
|
||||
@ -129,7 +130,7 @@ let AccordionListItemWallet = React.createClass({
|
||||
piece={this.props.content}
|
||||
subsubheading={
|
||||
<div className="pull-left">
|
||||
<span>{new Date(this.props.content.date_created).getFullYear()}</span>
|
||||
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||
{this.getLicences()}
|
||||
</div>}
|
||||
buttons={
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Link, History } from 'react-router';
|
||||
import Moment from 'moment';
|
||||
|
||||
import Row from 'react-bootstrap/lib/Row';
|
||||
import Col from 'react-bootstrap/lib/Col';
|
||||
@ -85,7 +86,7 @@ let Edition = React.createClass({
|
||||
<hr style={{marginTop: 0}}/>
|
||||
<h1 className="ascribe-detail-title">{this.props.edition.title}</h1>
|
||||
<EditionDetailProperty label="BY" value={this.props.edition.artist_name} />
|
||||
<EditionDetailProperty label="DATE" value={ new Date(this.props.edition.date_created).getFullYear() } />
|
||||
<EditionDetailProperty label="DATE" value={Moment(this.props.edition.date_created, 'YYYY-MM-DD').year()} />
|
||||
<hr/>
|
||||
</div>
|
||||
<EditionSummary
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { History } from 'react-router';
|
||||
import Moment from 'moment';
|
||||
|
||||
import PieceActions from '../../actions/piece_actions';
|
||||
import PieceStore from '../../stores/piece_store';
|
||||
@ -236,7 +237,7 @@ let PieceContainer = React.createClass({
|
||||
<hr style={{marginTop: 0}}/>
|
||||
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
|
||||
<DetailProperty label="BY" value={this.state.piece.artist_name} />
|
||||
<DetailProperty label="DATE" value={ new Date(this.state.piece.date_created).getFullYear() } />
|
||||
<DetailProperty label="DATE" value={Moment(this.state.piece.date_created, 'YYYY-MM-DD').year() } />
|
||||
{this.state.piece.num_editions > 0 ? <DetailProperty label="EDITIONS" value={ this.state.piece.num_editions } /> : null}
|
||||
<hr/>
|
||||
</div>
|
||||
|
@ -3,6 +3,7 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import StarRating from 'react-star-rating';
|
||||
import Moment from 'moment';
|
||||
|
||||
import PieceListActions from '../../../../../actions/piece_list_actions';
|
||||
import PieceListStore from '../../../../../stores/piece_list_store';
|
||||
@ -182,7 +183,7 @@ let AccordionListItemPrize = React.createClass({
|
||||
artistName={artistName}
|
||||
subsubheading={
|
||||
<div>
|
||||
<span>{new Date(this.props.content.date_created).getFullYear()}</span>
|
||||
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||
</div>}
|
||||
buttons={this.getPrizeButtons()}
|
||||
badge={this.getPrizeBadge()}>
|
||||
|
@ -145,7 +145,7 @@ let PieceContainer = React.createClass({
|
||||
<hr/>
|
||||
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
|
||||
<DetailProperty label={getLangText('BY')} value={artistName} />
|
||||
<DetailProperty label={getLangText('DATE')} value={new Date(this.state.piece.date_created).getFullYear()} />
|
||||
<DetailProperty label={getLangText('DATE')} value={Moment(this.state.piece.date_created, 'YYYY-MM-DD').year()} />
|
||||
{artistEmail}
|
||||
{this.getActions()}
|
||||
<hr/>
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Moment from 'moment';
|
||||
|
||||
import Piece from '../../../../../components/ascribe_detail/piece';
|
||||
|
||||
@ -39,7 +40,7 @@ let WalletPieceContainer = React.createClass({
|
||||
<hr style={{marginTop: 0}}/>
|
||||
<h1 className="ascribe-detail-title">{this.props.piece.title}</h1>
|
||||
<DetailProperty label="BY" value={this.props.piece.artist_name} />
|
||||
<DetailProperty label="DATE" value={new Date(this.props.piece.date_created).getFullYear()} />
|
||||
<DetailProperty label="DATE" value={Moment(this.props.piece.date_created, 'YYYY-MM-DD').year()} />
|
||||
<hr/>
|
||||
</div>
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Moment from 'moment';
|
||||
|
||||
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
||||
|
||||
@ -100,7 +101,7 @@ let CylandAccordionListItem = React.createClass({
|
||||
piece={this.props.content}
|
||||
subsubheading={
|
||||
<div className="pull-left">
|
||||
<span>{new Date(this.props.content.date_created).getFullYear()}</span>
|
||||
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||
</div>}
|
||||
buttons={this.getSubmitButtons()}>
|
||||
{this.props.children}
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Moment from 'moment';
|
||||
|
||||
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
||||
|
||||
@ -106,7 +107,7 @@ let IkonotvAccordionListItem = React.createClass({
|
||||
piece={this.props.content}
|
||||
subsubheading={
|
||||
<div className="pull-left">
|
||||
<span>{new Date(this.props.content.date_created).getFullYear()}</span>
|
||||
<span>{Moment(this.props.content.date_created, 'YYYY-MM-DD').year()}</span>
|
||||
</div>}
|
||||
buttons={this.getSubmitButtons()}>
|
||||
{this.props.children}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import Q from 'q';
|
||||
import SparkMD5 from 'spark-md5';
|
||||
import Moment from 'moment';
|
||||
|
||||
import { getLangText } from './lang_utils';
|
||||
|
||||
@ -37,7 +38,7 @@ export function computeHashOfFile(file) {
|
||||
let spark = new SparkMD5.ArrayBuffer();
|
||||
let fileReader = new FileReader();
|
||||
|
||||
let startTime = new Date();
|
||||
let startTime = new Moment();
|
||||
|
||||
// comment: We should convert this to es6 at some point, however if so please consider that
|
||||
// an arrow function will get rid of the function's scope...
|
||||
@ -53,7 +54,7 @@ export function computeHashOfFile(file) {
|
||||
|
||||
console.info('computed hash %s (took %d s)',
|
||||
fileHash,
|
||||
Math.round(((new Date() - startTime) / 1000) % 60)); // Compute hash
|
||||
Math.round(((new Moment() - startTime) / 1000) % 60)); // Compute hash
|
||||
|
||||
let blobTextFile = makeTextFile(fileHash, file);
|
||||
resolve(blobTextFile);
|
||||
|
Loading…
Reference in New Issue
Block a user