fixed time issue

This commit is contained in:
u-e 2019-02-06 15:13:59 +03:00
parent 3e6b5d6673
commit 5fab7325fa
2 changed files with 4 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class PostListItemView extends Component {
<View style={styles.header}>
<PostHeaderDescription
// date={intl.formatRelative(created)}
date={getTimeFromNow(created)}
date={getTimeFromNow(created, true)}
name={username}
reputation={reputation}
size={32}

View File

@ -11,9 +11,11 @@ const THIS_MONTH = moment()
.subtract(1, 'M')
.startOf('day');
export const getTimeFromNow = (value) => {
export const getTimeFromNow = (value, isWithoutUtc) => {
if (!value) return null;
if (isWithoutUtc) return moment(value).fromNow();
return moment.utc(value).fromNow();
};