From 042cf6c458eda50aedc5d0b5d644ef21b7492789 Mon Sep 17 00:00:00 2001 From: Cristian Giagante Date: Tue, 19 Oct 2021 00:14:19 -0300 Subject: [PATCH] Adds the transaction arrival time in local timezone to the transaction block content --- app/utils.js | 11 ++++++++++- views/includes/block-content.pug | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/utils.js b/app/utils.js index 5b7d74a4c..22ad2c143 100644 --- a/app/utils.js +++ b/app/utils.js @@ -822,6 +822,14 @@ function serviceBitsToName (services) { return serviceBits; } +function getTransactionDatetime(utcEpochTime) { + var epoch = new Date(0); + epoch.setUTCSeconds(utcEpochTime); + var formatted_date = epoch.getFullYear() + "-" + (epoch.getMonth() + 1) + "-" + epoch.getDate() + " " + epoch.toLocaleTimeString(); + + return formatted_date; +} + module.exports = { reflectPromise: reflectPromise, redirectToConnectPageIfNeeded: redirectToConnectPageIfNeeded, @@ -861,5 +869,6 @@ module.exports = { outputTypeAbbreviation: outputTypeAbbreviation, outputTypeName: outputTypeName, serviceBitsToName: serviceBitsToName, - perfMeasure: perfMeasure + perfMeasure: perfMeasure, + getTransactionDatetime: getTransactionDatetime }; diff --git a/views/includes/block-content.pug b/views/includes/block-content.pug index cda26dba4..cc08679a2 100644 --- a/views/includes/block-content.pug +++ b/views/includes/block-content.pug @@ -386,6 +386,7 @@ div.tab-content span(title=`Index in Block: #${(txIndex + offset).toLocaleString()}`, data-toggle="tooltip") ##{(txIndex + offset).toLocaleString()} span – a(href=("/tx/" + tx.txid)) #{tx.txid} + span – Transaction arrived at: #{utils.getTransactionDatetime(tx.time)} (local time) if (global.specialTransactions && global.specialTransactions[tx.txid]) span