From e2120a0b5c7264a9a741519b52f829d6ade95865 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Fri, 24 Jan 2014 15:27:32 +0000 Subject: [PATCH] bugfix --- raspberry-kiosk/kiosk.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js index 4a36fcb..52d84da 100644 --- a/raspberry-kiosk/kiosk.js +++ b/raspberry-kiosk/kiosk.js @@ -112,27 +112,36 @@ function calendarItemEnhancer(data) for (var s=0; s dt) + var stime = data[s].starttime; + var dt; + if (stime) { + dt = Date.parse(data[s].start+'T'+data[s].starttime); + } else { + dt = Date.parse(data[s].start); + } + if (stime && Date.now() > dt) { when = "JETZT"; } else { var weekday = weekday2str((new Date(dt)).getDay()); - var stime = data[s].starttime; var month = data[s].start.substring(5,7); if (month[0] == '0') month = month[1]; var dayofmonth = data[s].start.substring(8,10); if (dayofmonth[0] == '0') dayofmonth = dayofmonth[1]; - while (stime.substring(stime.length-3,stime.length) == ":00") - { - stime=stime.substring(0,stime.length-3); + if (stime) { + while (stime.substring(stime.length-3,stime.length) == ":00") + { + stime=stime.substring(0,stime.length-3); + } + if (stime.length <= 2) { stime+="h"; } + when = weekday + " " + dayofmonth+"."+month +", "+stime; + } else { + when = weekday + " " + dayofmonth+"."+month; } - if (stime.length <= 2) { stime+="h"; } - when = weekday + " " + dayofmonth+"."+month +", "+stime; } data[s].when = when } -- 1.7.10.4