fix: timestamp fix (#39)

* fix: test commit

* fix: instead of the time stamp being "a day ago"
it needs the actual time stamp
#40
pull/45/head
vpcodebase 3 years ago committed by GitHub
parent fb36e6286a
commit a33b555f78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 3
      src/components/tables/TransactionsTable.tsx
  3. 3
      src/components/transaction/helpers.tsx
  4. 2
      src/components/ui/RelativeTimer.tsx
  5. 2
      src/components/ui/Timestamp.tsx

@ -41,6 +41,8 @@ You don’t have to ever use `eject`. The curated feature set is suitable for sm
## Learn More ## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/). To learn React, check out the [React documentation](https://reactjs.org/).

@ -123,10 +123,9 @@ function getColumns(props: any) {
}, },
{ {
property: "timestamp", property: "timestamp",
size: "280px",
resizeable: false, resizeable: false,
header: ( header: (
<Text color="minorText" size="small" style={{ fontWeight: 300 }}> <Text color="minorText" size="small" style={{ fontWeight: 300, width: '180px' }}>
Timestamp Timestamp
</Text> </Text>
), ),

@ -17,6 +17,7 @@ import {
StakingTransactionTypeValue, StakingTransactionTypeValue,
CalculateFee, CalculateFee,
formatNumber, formatNumber,
RelativeTimer,
} from "../ui"; } from "../ui";
import { Box, Text } from "grommet"; import { Box, Text } from "grommet";
import { CopyBtn } from "../ui/CopyBtn"; import { CopyBtn } from "../ui/CopyBtn";
@ -168,7 +169,7 @@ export const transactionPropertyDisplayValues: any = {
), ),
hash_harmony: (value: any) => <TransactionHash hash={value} />, hash_harmony: (value: any) => <TransactionHash hash={value} />,
blockHash: (value: any) => <BlockHash hash={value} />, blockHash: (value: any) => <BlockHash hash={value} />,
timestamp: (value: any) => <Timestamp timestamp={value} withRelative />, timestamp: (value: any) => <RelativeTimer date={value} />,
gasUsed: (value: any, tx: RPCTransactionHarmony) => ( gasUsed: (value: any, tx: RPCTransactionHarmony) => (
<span> <span>
{value} ({+value / +tx.gas}%){" "} {value} ({+value / +tx.gas}%){" "}

@ -54,7 +54,7 @@ export function RelativeTimer(props: IRelativeTimer) {
const { date, render, updateInterval = 1000, style } = props; const { date, render, updateInterval = 1000, style } = props;
useEffect(() => { useEffect(() => {
const getTimeOffset = () => { const getTimeOffset = () => {
setFormattedValue(dayjs().to(dayjs(date))); setFormattedValue(dayjs(date).format("MM/DD/YYYY, HH:mm:ss"));
}; };
getTimeOffset(); getTimeOffset();
const tId = window.setInterval(getTimeOffset, updateInterval); const tId = window.setInterval(getTimeOffset, updateInterval);

@ -14,7 +14,7 @@ export const Timestamp = (props: TimestampProps) => {
return ( return (
<span> <span>
<Clock size="small" /> <Clock size="small" />
&nbsp;{dayjs(timestamp).format("YYYY-MM-DD, HH:mm:ss")} &nbsp;{dayjs(timestamp).format("YYYY-MM-DD, HH:mm:ss").toString()}
{withRelative && <span>, <RelativeTimer date={timestamp} /></span>} {withRelative && <span>, <RelativeTimer date={timestamp} /></span>}
</span> </span>
); );

Loading…
Cancel
Save