link fe: use correct time attribute

This commit is contained in:
Fang 2020-02-06 15:32:14 +01:00
parent 182d2c3a07
commit 50695fe78a
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
2 changed files with 6 additions and 6 deletions

View File

@ -36,7 +36,7 @@ export class LinkDetail extends Component {
}
componentDidUpdate(prevProps) {
if (this.props.data.timestamp !== prevProps.data.timestamp) {
if (this.props.data.time !== prevProps.data.time) {
this.setState({timeSinceLinkPost: this.getTimeSinceLinkPost()})
}
@ -53,8 +53,8 @@ export class LinkDetail extends Component {
}
getTimeSinceLinkPost() {
return !!this.props.data.timestamp ?
moment.unix(this.props.data.timestamp / 1000).from(moment.utc())
return !!this.props.data.time ?
moment.unix(this.props.data.time / 1000).from(moment.utc())
: '';
}

View File

@ -44,7 +44,7 @@ export class Links extends Component {
let LinkList = Object.keys(links)
.map((link) => {
let linksObj = props.links[linkPage];
let { title, url, timestamp, ship } = linksObj[link];
let { title, url, time, ship } = linksObj[link];
let members = {};
const commentCount = props.comments[url]
@ -71,12 +71,12 @@ export class Links extends Component {
return (
<LinkItem
key={timestamp}
key={time}
title={title}
page={props.page}
index={link}
url={url}
timestamp={timestamp}
timestamp={time}
nickname={nickname}
ship={ship}
color={color}