Etherscanでトランザクション詳細に表示されてるUTC表記のTimestampに日本時間を併記するスクリプト。
↓こんな感じに日本時間がすぐ分かる。
![]()
しかしこの画面で日本時間を知りたい人にはUTC表記を残しておく意味があるのかは疑問で、自分も必要ないんですがまあ両方あっても邪魔じゃないしこれでいいかなってことで。
そもそもこんな変更をするスクリプトが欲しい人が自分以外にいるかもかなーり疑問ではありますが。
// ==UserScript== // @name Etherscan Timestamp UTC + JST // @namespace https://etherscan.io/ // @version 1.2 // @description EtherscanのTimestampをUTCとJSTで併記表示 // @match https://etherscan.io/tx/* // @grant none // ==/UserScript== (function() { 'use strict'; function formatDate(date) { const y = date.getUTCFullYear(); const m = String(date.getUTCMonth() + 1).padStart(2, '0'); const d = String(date.getUTCDate()).padStart(2, '0'); const hh = String(date.getUTCHours()).padStart(2, '0'); const mm = String(date.getUTCMinutes()).padStart(2, '0'); const ss = String(date.getUTCSeconds()).padStart(2, '0'); return `${y}-${m}-${d} ${hh}:${mm}:${ss}`; } function convert() { const el = document.querySelector('#showUtcLocalDate'); if (!el) return; const ts = parseInt(el.getAttribute('data-timestamp'), 10); if (isNaN(ts)) return; // UTC日時 const utcDate = new Date(ts * 1000); const utcText = formatDate(utcDate) + ' UTC'; // JST日時 const jstDate = new Date((ts + 9 * 60 * 60) * 1000); const jstText = formatDate(jstDate) + ' JST'; // 表示更新 el.textContent = `${utcText} → ${jstText}`; } window.addEventListener('load', convert); })();
