diff --git a/base.json b/base.json index 18195a3..6762a94 100644 --- a/base.json +++ b/base.json @@ -9,6 +9,7 @@ "slots": { "Monday": [ { + "realtime": "2020-06-01T09:00:00Z", "desc": "09:00-10:45", "name": "MonA1" }, diff --git a/html/ptg.html b/html/ptg.html index 8816175..9f7d49e 100644 --- a/html/ptg.html +++ b/html/ptg.html @@ -112,7 +112,7 @@ {{#each times as |time|}} - + {{/each}} {{#each @root.schedule as |sched room|}} diff --git a/html/ptg.js b/html/ptg.js index e9cce88..6254b94 100644 --- a/html/ptg.js +++ b/html/ptg.js @@ -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 = '' + + time['desc'] +''; + } 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) {
{{time.desc}}{{ displaytime time }}