diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index 92574415..df0bb0d2 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -126,10 +126,16 @@ The following properties can be configured: todayText - Text to display when an event is planned for today.
+ Text to display when a fullday event is planned for today.

Default value: 'Today' + + tomorrowText + Text to display when a fullday event is planned for tomorrow.
+
Default value: 'Tomorrow' + + runningText Text to display when an event is still running.
diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 0b5627ff..30712f44 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -34,6 +34,7 @@ Module.register("calendar",{ // TODO: It would be nice if there is a way to get this from the Moment.js locale. todayText: "Today", + tomorrowText: "Tomorrow", runningText: "Ends in" }, @@ -117,11 +118,17 @@ Module.register("calendar",{ var timeWrapper = document.createElement("td"); //console.log(event.today); + var now = new Date(); if (event.fullDayEvent) { - timeWrapper.innerHTML = (event.today) ? this.config.todayText : moment(event.startDate,"x").fromNow(); + if (event.today) { + timeWrapper.innerHTML = this.config.todayText; + } else if (event.startDate - now < 24 * 60 * 60 * 1000) { + timeWrapper.innerHTML = this.config.tomorrowText; + } else { + timeWrapper.innerHTML = moment(event.startDate,"x").fromNow(); + } } else { if (event.startDate >= new Date()) { - var now = new Date(); if (event.startDate - now > 48 * 60 * 60 * 1000) { // if the event is no longer than 2 days away, display the absolute time. timeWrapper.innerHTML = moment(event.startDate,"x").fromNow();