UTC times can be confusing, explain times better

If real time equivalents for the time slots are provided, add
a link to timeanddate.com corresponding to the time, and display
browser local time equivalent for the time displayed.

Also make sure that the day tab corresponds to the UTC day (until
01 UTC the next day) whatever your timezone is.

Change-Id: I7847e0ac68fc6fcd176d40cc94d4e21c3c6e03e0
This commit is contained in:
Thierry Carrez 2020-05-06 15:56:26 +02:00
parent d2d7d21e98
commit 9339e42cae
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

@ -86,10 +86,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) {