Merge "UTC times can be confusing, explain times better"

This commit is contained in:
Zuul 2020-05-11 16:47:58 +00:00 committed by Gerrit Code Review
commit 220832e547
3 changed files with 20 additions and 2 deletions

View File

@ -9,6 +9,7 @@
"slots": {
"Monday": [
{
"realtime": "2020-06-01T09:00:00Z",
"desc": "09:00-10:45",
"name": "MonA1"
},

View File

@ -112,7 +112,7 @@
<table class="table table-condensed">
<thead><tr><th></th>
{{#each times as |time|}}
<th>{{time.desc}}</th>
<th>{{ displaytime time }}</th>
{{/each}}
</tr></thead>
{{#each @root.schedule as |sched room|}}

View File

@ -102,10 +102,27 @@ Handlebars.registerHelper('roomcode',
return new Handlebars.SafeString(cell);
});
Handlebars.registerHelper('displaytime',
function(time) {
if (time['realtime'] != undefined) {
var t = new Date(time['realtime']);
content = '<a target="_blank" href="' +
'https://www.timeanddate.com/worldclock/fixedtime.html?iso=' +
time['realtime'] + '" title="' + t + '">' +
time['desc'] +'</a>';
} else {
content = time['desc'];
}
return new Handlebars.SafeString(content);
});
// What is the day today ?
// Return Monday until Tuesday 1 UTC
var now = new Date();
now.setHours(now.getHours()-1);
var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var day = days[ now.getDay() ];
var day = days[ now.getUTCDay() ];
var checkins = {};
$.getJSON("ptg.json", function(json) {