feat: standardize timestamps throughout explorer (#15562)

* feat: timestamps should use local time everywhere but cluster stats, monospace text

* feat: normalize timestamp through explorer
This commit is contained in:
Josh 2021-02-26 10:47:03 -08:00 committed by GitHub
parent 05409e51ce
commit 28a8f142fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 7 deletions

View File

@ -311,7 +311,7 @@ function SysvarAccountClockCard({
<tr> <tr>
<td>Timestamp</td> <td>Timestamp</td>
<td className="text-lg-right"> <td className="text-lg-right text-monospace">
{displayTimestamp(sysvarAccount.info.unixTimestamp * 1000)} {displayTimestamp(sysvarAccount.info.unixTimestamp * 1000)}
</td> </td>
</tr> </tr>

View File

@ -65,7 +65,7 @@ export function VoteAccountSection({
<tr> <tr>
<td>Last Timestamp</td> <td>Last Timestamp</td>
<td className="text-lg-right"> <td className="text-lg-right text-monospace">
{displayTimestamp(voteAccount.info.lastTimestamp.timestamp * 1000)} {displayTimestamp(voteAccount.info.lastTimestamp.timestamp * 1000)}
</td> </td>
</tr> </tr>

View File

@ -8,6 +8,7 @@ import {
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address"; import { Address } from "components/common/Address";
import { InitializeInfo } from "./types"; import { InitializeInfo } from "./types";
import { displayTimestampUtc } from "utils/date";
export function InitializeDetailsCard(props: { export function InitializeDetailsCard(props: {
ix: ParsedInstruction; ix: ParsedInstruction;
@ -66,8 +67,8 @@ export function InitializeDetailsCard(props: {
{info.lockup.unixTimestamp > 0 && ( {info.lockup.unixTimestamp > 0 && (
<tr> <tr>
<td>Lockup Expiry Timestamp</td> <td>Lockup Expiry Timestamp</td>
<td className="text-lg-right"> <td className="text-lg-right text-monospace">
{new Date(info.lockup.unixTimestamp * 1000).toUTCString()} {displayTimestampUtc(info.lockup.unixTimestamp * 1000)}
</td> </td>
</tr> </tr>
)} )}

View File

@ -5,7 +5,7 @@ import { ParsedInfo } from "validators";
import { VoteInfo } from "./types"; import { VoteInfo } from "./types";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address"; import { Address } from "components/common/Address";
import { displayTimestampUtc } from "utils/date"; import { displayTimestamp } from "utils/date";
export function VoteDetailsCard(props: { export function VoteDetailsCard(props: {
ix: ParsedInstruction; ix: ParsedInstruction;
@ -72,7 +72,7 @@ export function VoteDetailsCard(props: {
<tr> <tr>
<td>Timestamp</td> <td>Timestamp</td>
<td className="text-lg-right text-monospace"> <td className="text-lg-right text-monospace">
{displayTimestampUtc(info.vote.timestamp * 1000)} {displayTimestamp(info.vote.timestamp * 1000)}
</td> </td>
</tr> </tr>

View File

@ -237,7 +237,9 @@ function StatusCard({
<td>Timestamp</td> <td>Timestamp</td>
<td className="text-lg-right"> <td className="text-lg-right">
{info.timestamp !== "unavailable" ? ( {info.timestamp !== "unavailable" ? (
displayTimestamp(info.timestamp * 1000) <span className="text-monospace">
{displayTimestamp(info.timestamp * 1000)}
</span>
) : ( ) : (
<InfoTooltip <InfoTooltip
bottom bottom