mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Now server started shows browser time, not server time.
This commit is contained in:
parent
4c9f947aa1
commit
359a2e1c42
@ -125,7 +125,9 @@ class PanelHandler(BaseHandler):
|
||||
|
||||
self.render(
|
||||
template,
|
||||
data=page_data
|
||||
data=page_data,
|
||||
time=time,
|
||||
utc_offset=(time.timezone * -1 / 60 / 60),
|
||||
)
|
||||
|
||||
@tornado.web.authenticated
|
||||
|
@ -78,12 +78,27 @@
|
||||
return output;
|
||||
}
|
||||
|
||||
document.addEventListener('load', () => {
|
||||
document.body.onload = (() => {
|
||||
|
||||
console.log('calculateTime');
|
||||
let uptime = document.querySelector('#uptime');
|
||||
let started = document.querySelector('#started');
|
||||
|
||||
if (started != null) {
|
||||
let startedUTC = '{{ (datetime.datetime.strptime(data['server_stats'][0]['started'], '%Y-%m-%d %H:%M:%S') - datetime.timedelta(seconds=-time.timezone)).strftime('%Y-%m-%d %H:%M:%S') }}';
|
||||
console.log('utc', startedUTC);
|
||||
startedUTC = moment.utc(startedUTC, 'YYYY-MM-DD HH:mm:ss');
|
||||
|
||||
let browserUTCOffset = moment().utcOffset(); // This is in minutes
|
||||
|
||||
let startedLocal = startedUTC.utcOffset(browserUTCOffset);
|
||||
startedLocal = startedLocal.format('YYYY-MM-DD HH:mm:ss');
|
||||
|
||||
console.log('local', startedLocal);
|
||||
|
||||
started.textContent = startedLocal
|
||||
}
|
||||
|
||||
let nowServerTime = '{{ data['time'] }}';
|
||||
let startedServerTime = '{{ data['server_stats'][0]['started'] }}';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user