created temporary solution for time

This commit is contained in:
u-e 2019-01-11 09:34:18 +03:00
parent 3326f97395
commit cabd822539
6 changed files with 28 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import React, { PureComponent, Fragment } from 'react';
import { View, FlatList } from 'react-native';
import { injectIntl } from 'react-intl';
import { getTimeFromNow } from '../../../utils/time';
// Constants
// Components
@ -57,7 +58,8 @@ class CommentsView extends PureComponent {
<View key={index}>
<PostHeaderDescription
key={item.permlink}
date={intl.formatRelative(item.created)}
// date={intl.formatRelative(item.created)}
date={getTimeFromNow(item.created)}
name={item.author}
reputation={item.author_reputation}
size={avatarSize || 24}

View File

@ -3,6 +3,9 @@ import { TouchableOpacity, Text, View } from 'react-native';
import FastImage from 'react-native-fast-image';
import { injectIntl } from 'react-intl';
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components
import { PostHeaderDescription } from '../../postElements';
import { PostDropdown } from '../../postDropdown';
@ -54,7 +57,9 @@ class PostCardView extends Component {
};
render() {
const { content, isHideImage, fetchPost, intl } = this.props;
const {
content, isHideImage, fetchPost, intl,
} = this.props;
const _image = content && content.image
? { uri: content.image, priority: FastImage.priority.high }
: DEFAULT_IMAGE;
@ -64,7 +69,8 @@ class PostCardView extends Component {
<View style={styles.post}>
<View style={styles.bodyHeader}>
<PostHeaderDescription
date={intl.formatRelative(content.created)}
// date={intl.formatRelative(content.created)}
date={getTimeFromNow(content.created)}
isHideImage={isHideImage}
name={content.author}
profileOnPress={this._handleOnUserPress}

View File

@ -4,6 +4,9 @@ import { View, Text, TouchableOpacity } from 'react-native';
import { injectIntl } from 'react-intl';
import FastImage from 'react-native-fast-image';
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components
import { PostHeaderDescription } from '../../postElements';
import { IconButton } from '../../iconButton';
@ -49,7 +52,8 @@ class PostListItemView extends Component {
<View style={styles.container}>
<View style={styles.header}>
<PostHeaderDescription
date={intl.formatRelative(created)}
// date={intl.formatRelative(created)}
date={getTimeFromNow(created)}
name={username}
reputation={reputation}
size={32}

View File

@ -4,7 +4,8 @@ import {
} from 'react-native';
import { injectIntl } from 'react-intl';
// Constants
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components
import { PostHeaderDescription, PostBody, Tags } from '../../postElements';
@ -115,7 +116,7 @@ class PostDisplayView extends PureComponent {
const isPostEnd = scrollHeight > postHeight;
const isGetComment = scrollHeight + 300 > postHeight;
const formatedTime = post && intl.formatRelative(post.created);
const formatedTime = post && getTimeFromNow(post.created);
if (isGetComment && !isLoadedComments) this.setState({ isLoadedComments: true });

View File

@ -4,6 +4,9 @@ import { injectIntl } from 'react-intl';
// Utilities
import { groomingTransactionData } from '../../../utils/wallet';
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components
// import { FilterBar } from '../../filterBar';
import { WalletLineItem, Card } from '../../basicUIElements';
@ -62,7 +65,8 @@ class TransactionView extends PureComponent {
text={intl.formatMessage({
id: `wallet.${transactionData.opName}`,
})}
description={intl.formatRelative(transactionData.transDate)}
// description={intl.formatRelative(transactionData.transDate)}
description={getTimeFromNow(transactionData.transDate)}
isCircleIcon
isThin
circleIconColor="white"

View File

@ -2,7 +2,8 @@ import React, { PureComponent } from 'react';
import { View, FlatList, Text } from 'react-native';
import { injectIntl } from 'react-intl';
// Constants
// Utils
import { getTimeFromNow } from '../../../utils/time';
// Components
import { UserListItem } from '../../basicUIElements';
@ -28,7 +29,8 @@ class VotersDisplayView extends PureComponent {
avatar={item.avatar}
index={index}
username={item.voter}
description={intl.formatRelative(item.time)}
// description={intl.formatRelative(item.time)}
description={getTimeFromNow(item.time)}
isHasRightItem
isRightColor={item.is_down_vote}
rightText={value}