diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 253ea708..b2828c22 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -115,7 +115,12 @@ Module.register("calendar",{ eventWrapper.appendChild(titleWrapper); var timeWrapper = document.createElement("td"); - timeWrapper.innerHTML = (event.today) ? this.config.todayText : moment(event.startDate,"x").fromNow(); + //console.log(event.today); + if (event.fullDayEvent) { + timeWrapper.innerHTML = (event.today) ? this.config.todayText : moment(event.startDate,"x").fromNow(); + } else { + timeWrapper.innerHTML = moment(event.startDate,"x").fromNow(); + } // timeWrapper.innerHTML = moment(event.startDate,'x').format('lll'); timeWrapper.className = "time light"; eventWrapper.appendChild(timeWrapper); diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 4007bc9a..7e6501e3 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -95,13 +95,34 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe } else { // console.log("Single event ..."); // Single event. - if (startDate >= today && startDate <= future) { - newEvents.push({ - title: (typeof event.summary.val !== "undefined") ? event.summary.val : event.summary, - startDate: startDate.format("x"), - fullDayEvent: (event.start.length === 8) - }); + var fullDayEvent = (event.start.length === 8); + var title = (typeof event.summary.val !== "undefined") ? event.summary.val : event.summary; + + if (!fullDayEvent && startDate < new Date()) { + // it's not a fullday event, and it is in the past. So skip. + console.log("It's not a fullday event, and it is in the past. So skip: " + title); + continue; } + + if (fullDayEvent && startDate < today) { + // it's a fullday event, and it is before today. So skip. + console.log("It's a fullday event, and it is before today. So skip: " + title); + continue; + } + + if (startDate > future) { + // it exceeds the maximumNumberOfDays limit. So skip + console.log("It exceeds the maximumNumberOfDays limit. So skip: " + title); + continue; + } + + // Every thing is good. Add it to the list. + newEvents.push({ + title: title, + startDate: startDate.format("x"), + fullDayEvent: fullDayEvent + }); + } } }