explorer: Display block timestamp (#20309)
This commit is contained in:
parent
062d8e6c5a
commit
32ece63338
|
@ -12,6 +12,7 @@ import { NavLink } from "react-router-dom";
|
||||||
import { clusterPath } from "utils/url";
|
import { clusterPath } from "utils/url";
|
||||||
import { BlockProgramsCard } from "./BlockProgramsCard";
|
import { BlockProgramsCard } from "./BlockProgramsCard";
|
||||||
import { BlockAccountsCard } from "./BlockAccountsCard";
|
import { BlockAccountsCard } from "./BlockAccountsCard";
|
||||||
|
import { displayTimestamp, displayTimestampUtc } from "utils/date";
|
||||||
|
|
||||||
export function BlockOverviewCard({
|
export function BlockOverviewCard({
|
||||||
slot,
|
slot,
|
||||||
|
@ -65,6 +66,26 @@ export function BlockOverviewCard({
|
||||||
<span>{block.blockhash}</span>
|
<span>{block.blockhash}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{block.blockTime && (
|
||||||
|
<>
|
||||||
|
<tr>
|
||||||
|
<td>Timestamp (Local)</td>
|
||||||
|
<td className="text-lg-right">
|
||||||
|
<span className="text-monospace">
|
||||||
|
{displayTimestamp(block.blockTime * 1000, true)}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Timestamp (UTC)</td>
|
||||||
|
<td className="text-lg-right">
|
||||||
|
<span className="text-monospace">
|
||||||
|
{displayTimestampUtc(block.blockTime * 1000, true)}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<tr>
|
<tr>
|
||||||
<td className="w-100">Parent Slot</td>
|
<td className="w-100">Parent Slot</td>
|
||||||
<td className="text-lg-right text-monospace">
|
<td className="text-lg-right text-monospace">
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function displayTimestampUtc(
|
||||||
const expireDate = new Date(unixTimestamp);
|
const expireDate = new Date(unixTimestamp);
|
||||||
const dateString = new Intl.DateTimeFormat("en-US", {
|
const dateString = new Intl.DateTimeFormat("en-US", {
|
||||||
year: "numeric",
|
year: "numeric",
|
||||||
month: "long",
|
month: "short",
|
||||||
day: "numeric",
|
day: "numeric",
|
||||||
timeZone: "UTC",
|
timeZone: "UTC",
|
||||||
}).format(expireDate);
|
}).format(expireDate);
|
||||||
|
|
Loading…
Reference in New Issue