From 28a8f142fcc44482723e629ced65e6de9a8b030b Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 26 Feb 2021 10:47:03 -0800 Subject: [PATCH] feat: standardize timestamps throughout explorer (#15562) * feat: timestamps should use local time everywhere but cluster stats, monospace text * feat: normalize timestamp through explorer --- explorer/src/components/account/SysvarAccountSection.tsx | 2 +- explorer/src/components/account/VoteAccountSection.tsx | 2 +- .../components/instruction/stake/InitializeDetailsCard.tsx | 5 +++-- explorer/src/components/instruction/vote/VoteDetailsCard.tsx | 4 ++-- explorer/src/pages/TransactionDetailsPage.tsx | 4 +++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/explorer/src/components/account/SysvarAccountSection.tsx b/explorer/src/components/account/SysvarAccountSection.tsx index 88babaab7b..9e352981c0 100644 --- a/explorer/src/components/account/SysvarAccountSection.tsx +++ b/explorer/src/components/account/SysvarAccountSection.tsx @@ -311,7 +311,7 @@ function SysvarAccountClockCard({ Timestamp - + {displayTimestamp(sysvarAccount.info.unixTimestamp * 1000)} diff --git a/explorer/src/components/account/VoteAccountSection.tsx b/explorer/src/components/account/VoteAccountSection.tsx index 1611fdad4f..2df3b11619 100644 --- a/explorer/src/components/account/VoteAccountSection.tsx +++ b/explorer/src/components/account/VoteAccountSection.tsx @@ -65,7 +65,7 @@ export function VoteAccountSection({ Last Timestamp - + {displayTimestamp(voteAccount.info.lastTimestamp.timestamp * 1000)} diff --git a/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx b/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx index 9c2f5a29e7..fac0517204 100644 --- a/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx @@ -8,6 +8,7 @@ import { import { InstructionCard } from "../InstructionCard"; import { Address } from "components/common/Address"; import { InitializeInfo } from "./types"; +import { displayTimestampUtc } from "utils/date"; export function InitializeDetailsCard(props: { ix: ParsedInstruction; @@ -66,8 +67,8 @@ export function InitializeDetailsCard(props: { {info.lockup.unixTimestamp > 0 && ( Lockup Expiry Timestamp - - {new Date(info.lockup.unixTimestamp * 1000).toUTCString()} + + {displayTimestampUtc(info.lockup.unixTimestamp * 1000)} )} diff --git a/explorer/src/components/instruction/vote/VoteDetailsCard.tsx b/explorer/src/components/instruction/vote/VoteDetailsCard.tsx index c06f86d2de..d00a711d38 100644 --- a/explorer/src/components/instruction/vote/VoteDetailsCard.tsx +++ b/explorer/src/components/instruction/vote/VoteDetailsCard.tsx @@ -5,7 +5,7 @@ import { ParsedInfo } from "validators"; import { VoteInfo } from "./types"; import { InstructionCard } from "../InstructionCard"; import { Address } from "components/common/Address"; -import { displayTimestampUtc } from "utils/date"; +import { displayTimestamp } from "utils/date"; export function VoteDetailsCard(props: { ix: ParsedInstruction; @@ -72,7 +72,7 @@ export function VoteDetailsCard(props: { Timestamp - {displayTimestampUtc(info.vote.timestamp * 1000)} + {displayTimestamp(info.vote.timestamp * 1000)} diff --git a/explorer/src/pages/TransactionDetailsPage.tsx b/explorer/src/pages/TransactionDetailsPage.tsx index be704e6832..4ae3e4e0a7 100644 --- a/explorer/src/pages/TransactionDetailsPage.tsx +++ b/explorer/src/pages/TransactionDetailsPage.tsx @@ -237,7 +237,9 @@ function StatusCard({ Timestamp {info.timestamp !== "unavailable" ? ( - displayTimestamp(info.timestamp * 1000) + + {displayTimestamp(info.timestamp * 1000)} + ) : (