1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Using format.js

https://github.com/tooot-app/app/issues/280
This commit is contained in:
Zhiyuan Zheng
2022-05-08 17:56:26 +02:00
parent edb332bb26
commit 4c9f93497d
17 changed files with 270 additions and 156 deletions

View File

@ -17,6 +17,7 @@ import { useTheme } from '@utils/styles/ThemeManager'
import { maxBy } from 'lodash'
import React, { useCallback, useMemo, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { FormattedRelativeTime } from 'react-intl'
import { Pressable, StyleSheet, Text, View } from 'react-native'
import { useQueryClient } from 'react-query'
@ -158,7 +159,16 @@ const TimelinePoll: React.FC<Props> = ({
<CustomText fontStyle='S' style={{ color: colors.secondary }}>
<Trans
i18nKey='componentTimeline:shared.poll.meta.expiration.until'
components={[<RelativeTime date={poll.expires_at} />]}
components={[
<FormattedRelativeTime
value={
(new Date(poll.expires_at).getTime() -
new Date().getTime()) /
1000
}
updateIntervalInSeconds={1}
/>
]}
/>
</CustomText>
)