Browse Source

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
changes/70/725870/1
Thierry Carrez 6 months ago
parent
commit
9339e42cae
3 changed files with 20 additions and 2 deletions
  1. +1
    -0
      base.json
  2. +1
    -1
      html/ptg.html
  3. +18
    -1
      html/ptg.js

+ 1
- 0
base.json View File

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


+ 1
- 1
html/ptg.html 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|}}


+ 18
- 1
html/ptg.js 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) {


Loading…
Cancel
Save