From 11fad5aaeebaad1cae0463a24befb4dd29d01a4d Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 12 Mar 2019 13:20:34 +0300 Subject: [PATCH 1/3] Exact date and time for Transaction details page --- apps/block_scout_web/assets/js/lib/from_now.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/block_scout_web/assets/js/lib/from_now.js b/apps/block_scout_web/assets/js/lib/from_now.js index d0f1d57f63..2508d8e496 100644 --- a/apps/block_scout_web/assets/js/lib/from_now.js +++ b/apps/block_scout_web/assets/js/lib/from_now.js @@ -19,7 +19,14 @@ function tryUpdateAge (el) { if (timestamp.isValid()) updateAge(el, timestamp) } function updateAge (el, timestamp) { - const fromNow = timestamp.fromNow() + let fromNow = timestamp.fromNow() + //show the exact time only for transaction details page. Otherwise, short entry + if (window.location.pathname.startsWith('/tx/')) { + const offset = moment().utcOffset() / 60 + const sign = offset && Math.sign(offset) ? '+' : '-'; + const formatDate = `MMMM-DD-YYYY hh:mm:ss A ${sign}${offset} UTC` + fromNow = `${fromNow} (${timestamp.format(formatDate)})` + } if (fromNow !== el.innerHTML) el.innerHTML = fromNow } updateAllAges() From cbc2ccc5e745ec9cd013f24edf563aa2a5932951 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 12 Mar 2019 13:29:14 +0300 Subject: [PATCH 2/3] Convert indentions to spaces --- apps/block_scout_web/assets/js/lib/from_now.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/block_scout_web/assets/js/lib/from_now.js b/apps/block_scout_web/assets/js/lib/from_now.js index 2508d8e496..ba2214c8a6 100644 --- a/apps/block_scout_web/assets/js/lib/from_now.js +++ b/apps/block_scout_web/assets/js/lib/from_now.js @@ -22,10 +22,10 @@ function updateAge (el, timestamp) { let fromNow = timestamp.fromNow() //show the exact time only for transaction details page. Otherwise, short entry if (window.location.pathname.startsWith('/tx/')) { - const offset = moment().utcOffset() / 60 - const sign = offset && Math.sign(offset) ? '+' : '-'; - const formatDate = `MMMM-DD-YYYY hh:mm:ss A ${sign}${offset} UTC` - fromNow = `${fromNow} (${timestamp.format(formatDate)})` + const offset = moment().utcOffset() / 60 + const sign = offset && Math.sign(offset) ? '+' : '-'; + const formatDate = `MMMM-DD-YYYY hh:mm:ss A ${sign}${offset} UTC` + fromNow = `${fromNow} (${timestamp.format(formatDate)})` } if (fromNow !== el.innerHTML) el.innerHTML = fromNow } From 95d6fc44d2295a5cbc4ba2eab440d8a5e0799aee Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 12 Mar 2019 13:36:05 +0300 Subject: [PATCH 3/3] ESLint fixes --- apps/block_scout_web/assets/js/lib/from_now.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/block_scout_web/assets/js/lib/from_now.js b/apps/block_scout_web/assets/js/lib/from_now.js index ba2214c8a6..f4bad344cb 100644 --- a/apps/block_scout_web/assets/js/lib/from_now.js +++ b/apps/block_scout_web/assets/js/lib/from_now.js @@ -20,10 +20,10 @@ function tryUpdateAge (el) { } function updateAge (el, timestamp) { let fromNow = timestamp.fromNow() - //show the exact time only for transaction details page. Otherwise, short entry + // show the exact time only for transaction details page. Otherwise, short entry if (window.location.pathname.startsWith('/tx/')) { const offset = moment().utcOffset() / 60 - const sign = offset && Math.sign(offset) ? '+' : '-'; + const sign = offset && Math.sign(offset) ? '+' : '-' const formatDate = `MMMM-DD-YYYY hh:mm:ss A ${sign}${offset} UTC` fromNow = `${fromNow} (${timestamp.format(formatDate)})` }