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. 5
      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
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/).

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

@ -17,6 +17,7 @@ import {
StakingTransactionTypeValue,
CalculateFee,
formatNumber,
RelativeTimer,
} from "../ui";
import { Box, Text } from "grommet";
import { CopyBtn } from "../ui/CopyBtn";
@ -168,7 +169,7 @@ export const transactionPropertyDisplayValues: any = {
),
hash_harmony: (value: any) => <TransactionHash 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) => (
<span>
{value} ({+value / +tx.gas}%){" "}

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

@ -14,7 +14,7 @@ export const Timestamp = (props: TimestampProps) => {
return (
<span>
<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>}
</span>
);

Loading…
Cancel
Save