Commit 341756f6 authored by isstuev's avatar isstuev

fix time ago

parent cec56f19
...@@ -19,7 +19,7 @@ function getUnits(diff: number) { ...@@ -19,7 +19,7 @@ function getUnits(diff: number) {
return [ DAY, 2 * DAY ]; return [ DAY, 2 * DAY ];
} }
function getUpdateParams(ts: string) { function getUpdateParams(ts: string | number) {
const timeDiff = Date.now() - new Date(ts).getTime(); const timeDiff = Date.now() - new Date(ts).getTime();
const [ unit, higherUnit ] = getUnits(timeDiff); const [ unit, higherUnit ] = getUnits(timeDiff);
...@@ -41,7 +41,7 @@ function getUpdateParams(ts: string) { ...@@ -41,7 +41,7 @@ function getUpdateParams(ts: string) {
}; };
} }
export default function useTimeAgoIncrement(ts: string | null, isEnabled?: boolean) { export default function useTimeAgoIncrement(ts: string | number | null, isEnabled?: boolean) {
const [ value, setValue ] = React.useState(ts ? dayjs(ts).fromNow() : null); const [ value, setValue ] = React.useState(ts ? dayjs(ts).fromNow() : null);
React.useEffect(() => { React.useEffect(() => {
......
...@@ -41,7 +41,7 @@ const AddressAccountHistoryListItem = (props: Props) => { ...@@ -41,7 +41,7 @@ const AddressAccountHistoryListItem = (props: Props) => {
</Text> </Text>
</Flex> </Flex>
<TimeAgoWithTooltip <TimeAgoWithTooltip
timestamp={ (props.tx.rawTransactionData.timestamp * 1000).toString() } timestamp={ props.tx.rawTransactionData.timestamp * 1000 }
color="text_secondary" color="text_secondary"
borderRadius="sm" borderRadius="sm"
fontWeight={ 500 } fontWeight={ 500 }
......
...@@ -26,7 +26,7 @@ const AddressAccountHistoryTableItem = (props: Props) => { ...@@ -26,7 +26,7 @@ const AddressAccountHistoryTableItem = (props: Props) => {
<Tr> <Tr>
<Td px={ 3 } py="18px" fontSize="sm" > <Td px={ 3 } py="18px" fontSize="sm" >
<TimeAgoWithTooltip <TimeAgoWithTooltip
timestamp={ (props.tx.rawTransactionData.timestamp * 1000).toString() } timestamp={ props.tx.rawTransactionData.timestamp * 1000 }
isLoading={ props.isPlaceholderData } isLoading={ props.isPlaceholderData }
color="text_secondary" color="text_secondary"
borderRadius="sm" borderRadius="sm"
......
...@@ -5,7 +5,7 @@ import dayjs from 'lib/date/dayjs'; ...@@ -5,7 +5,7 @@ import dayjs from 'lib/date/dayjs';
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
type Props = { type Props = {
timestamp?: string | null; timestamp?: string | number | null;
fallbackText?: string; fallbackText?: string;
isLoading?: boolean; isLoading?: boolean;
enableIncrement?: boolean; enableIncrement?: boolean;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment