Merge pull request #1586 from poanetwork/exact-timestamp-fix

(Fix) Exact timestamp display
pull/1595/head
Victor Baranov 6 years ago committed by GitHub
commit d86cea2ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      apps/block_scout_web/assets/js/lib/from_now.js
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex
  3. 2
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex

@ -21,7 +21,8 @@ function tryUpdateAge (el) {
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 elInTile = el.hasAttribute('in-tile')
if (window.location.pathname.includes('/tx/') && !elInTile) {
const offset = moment().utcOffset() / 60
const sign = offset && Math.sign(offset) ? '+' : '-'
const formatDate = `MMMM-DD-YYYY hh:mm:ss A ${sign}${offset} UTC`

@ -23,7 +23,7 @@
to: block_path(BlockScoutWeb.Endpoint, :show, @internal_transaction.block_number)
) %>
</span>
<span class="mr-2 mr-md-0 order-2" data-from-now="<%= @internal_transaction.transaction.block.timestamp %>"></span>
<span class="mr-2 mr-md-0 order-2" in-tile data-from-now="<%= @internal_transaction.transaction.block.timestamp %>"></span>
<%= if assigns[:current_address] do %>
<span class="mr-2 mr-md-0 order-0 order-md-3">
<%= if assigns[:current_address].hash == @internal_transaction.from_address_hash do %>

@ -35,7 +35,7 @@
<span class="mr-2 mr-md-0 order-1">
<%= @transaction |> block_number() |> BlockScoutWeb.RenderHelpers.render_partial() %>
</span>
<span class="mr-2 mr-md-0 order-2" data-from-now="<%= block_timestamp(@transaction) %>"></span>
<span class="mr-2 mr-md-0 order-2" in-tile data-from-now="<%= block_timestamp(@transaction) %>"></span>
<%= if from_or_to_address?(@transaction, assigns[:current_address]) do %>
<span class="mr-2 mr-md-0 order-0 order-md-3">
<%= if @transaction.from_address_hash == assigns[:current_address].hash do %>

Loading…
Cancel
Save