@@ -58,17 +58,31 @@ ethplorerWidget = {
58
58
return '<a class="tx-link" href="' + ethplorerWidget . url + '/' + linkType + '/' + data + hash + '" title="' + title + '" target="_blank">' + text + '</a>' ;
59
59
} ,
60
60
61
- // Date with fixed GMT to local date
62
- ts2date : function ( ts , withGMT ) {
61
+ // Timestamp to local date
62
+ ts2date : function ( ts , withTime , withGMT ) {
63
+ withGMT = 'undefined' !== typeof ( withGMT ) ? withGMT : true ;
64
+ ts *= 1000 ;
65
+ function padZero ( s ) {
66
+ return ( s < 10 ) ? '0' + s : s . toString ( ) ;
67
+ }
68
+ var res = '' ;
69
+ var dt = new Date ( ts ) ;
70
+ res += ( dt . getFullYear ( ) + '-' + padZero ( ( dt . getMonth ( ) + 1 ) ) + '-' + padZero ( dt . getDate ( ) ) ) ;
71
+ if ( withTime ) {
72
+ res += ' ' ;
73
+ res += ethplorerWidget . Utils . ts2time ( ts , withGMT ) ;
74
+ }
75
+ return res ;
76
+ } ,
77
+ //Timestamp to local time
78
+ ts2time : function ( ts , withGMT ) {
63
79
withGMT = 'undefined' !== typeof ( withGMT ) ? withGMT : true ;
64
80
ts *= 1000 ;
65
81
function padZero ( s ) {
66
82
return ( s < 10 ) ? '0' + s : s . toString ( ) ;
67
83
}
68
84
var res = '' ;
69
85
var dt = new Date ( ts ) ;
70
- /*res += (dt.getFullYear() + '-' + padZero((dt.getMonth() + 1)) + '-' + padZero(dt.getDate()));
71
- res += ' '*/ ;
72
86
res += ( padZero ( dt . getHours ( ) ) + ':' + padZero ( dt . getMinutes ( ) ) + ':' + padZero ( dt . getSeconds ( ) ) ) ;
73
87
if ( withGMT ) {
74
88
res += ( ' (' + Ethplorer . Utils . getTZOffset ( ) + ')' ) ;
@@ -166,14 +180,14 @@ ethplorerWidget.Type['tokenHistory'] = function(element, options, templates){
166
180
debug : '<div class="txs-debug"><div class="txs-stop"></div></div>' ,
167
181
// Big table row
168
182
big : '<tr>' +
169
- '<td class="tx-field tx-date">%date %</td>' +
183
+ '<td class="tx-field tx-date">%time %</td>' +
170
184
'<td class="tx-field tx-transfer"><span class="tx-send">from </span>%from%<span class="tx-send">to</span>%to%</td>' +
171
185
'<td class="tx-field tx-amount">%amount%</td>' +
172
186
'<td class="tx-field tx-token">%token%</td>' +
173
187
'</tr>' ,
174
188
// Small table row
175
189
small : '<tr>' +
176
- '<td class="tx-field tx-date">%date %</td>' +
190
+ '<td class="tx-field tx-date">%time %</td>' +
177
191
'<td class="tx-field tx-transfer"><span class="tx-send">from </span>%from%</td>' +
178
192
'</tr><tr>' +
179
193
'<td class="tx-field"> </td>' +
@@ -348,7 +362,9 @@ ethplorerWidget.Type['tokenHistory'] = function(element, options, templates){
348
362
var hash = tr . priority ? tr . priority : false ;
349
363
350
364
return {
351
- date : ethplorerWidget . Utils . link ( tr . transactionHash , ethplorerWidget . Utils . ts2date ( tr . timestamp , false ) , tr . transactionHash , hash ) ,
365
+ date : ethplorerWidget . Utils . link ( tr . transactionHash , ethplorerWidget . Utils . ts2date ( tr . timestamp , false , false ) , tr . transactionHash , hash ) ,
366
+ time : ethplorerWidget . Utils . link ( tr . transactionHash , ethplorerWidget . Utils . ts2time ( tr . timestamp , false ) , tr . transactionHash , hash ) ,
367
+ datetime : ethplorerWidget . Utils . link ( tr . transactionHash , ethplorerWidget . Utils . ts2date ( tr . timestamp , true , false ) , tr . transactionHash , hash ) ,
352
368
from : ethplorerWidget . Utils . link ( tr . from , tr . from ) ,
353
369
to : ethplorerWidget . Utils . link ( tr . to , tr . to ) ,
354
370
amount : ethplorerWidget . Utils . link ( tr . tokenInfo . address , amount , amount + ' ' + tr . tokenInfo . symbol ) ,
0 commit comments