gmt timezone change
How can i change the timezone on the explorer?
same here
i did it :sweat_smile: toTimeString() set time to your current timezone.
https://github.com/sugarchain-project/explorer/commit/af9515b18da47f9ee94a99b03dc12e2e0600ce36
sorry it has some bug. i will find another way
Does the above commit work or is there still a bug?
still no way
with some code changes (and by adding moment-timezone, like from cdnjs) you can just make it so the browser timezone is used. quick and dirty tho, but works on modern browsers.
for the index, movement and address_history view you can add something like this to the right parts of document.ready function
var mom = moment(data[0]);
var client_tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
var timestamp = mom.tz(client_tz).format('dddd, Do of MMMM YYYY, HH:mm:ss zz');
for the block and tx view you'll need to change the template so the table cells containing the timestamp have an ID, i.e.:
td.d-none.d-sm-table-cell.d-table-cell#blocktime=time
then use similar code like above to "momentjs over the generated page" before rendering, clientside.
i.e.
script.
$(document).ready(function(){
moment.locale(navigator.languages[0]);
var mom = moment($("#blocktime"));
var client_tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
var timestamp = mom.tz(client_tz).format('dddd, Do of MMMM YYYY, HH:mm:ss zz');
$("#blocktime").text(timestamp);
});
i know this is like superhackish, but works for me. @TheHolyRoger if you would like to have a PR with this, let me know.
for reference, i have just put the "local timestamps" feature to production at https://explorer.verus.io/