don’t use FormattedRelative

This commit is contained in:
SachaG 2017-06-18 15:40:23 +09:00
parent eebcd9436e
commit 2ed1762e3e

View file

@ -3,6 +3,7 @@ import React from 'react';
import { FormattedMessage, FormattedRelative } from 'meteor/vulcan:i18n';
import { Link } from 'react-router';
import Posts from "meteor/vulcan:posts";
import moment from 'moment';
class CustomPostsItem extends getRawComponent('PostsItem') {
@ -39,7 +40,7 @@ class CustomPostsItem extends getRawComponent('PostsItem') {
<div className="posts-item-meta">
{post.user? <div className="posts-item-user"><Components.UsersAvatar user={post.user} size="small"/><Components.UsersName user={post.user}/></div> : null}
<div className="posts-item-date"><FormattedRelative value={post.postedAt}/></div>
<div className="posts-item-date">{post.postedAt ? moment(new Date(post.postedAt)).fromNow() : <FormattedMessage id="posts.dateNotDefined"/>}</div>
<div className="posts-item-comments">
<Link to={Posts.getPageUrl(post)}>
{!post.commentCount || post.commentCount === 0 ? <FormattedMessage id="comments.count_0"/> :
@ -56,7 +57,6 @@ class CustomPostsItem extends getRawComponent('PostsItem') {
{this.renderCommenters()}
</div>
)
}