Show 'tomorrow' when a full day event is planned for tomorrow.

This commit is contained in:
Michael Teeuw
2016-04-20 21:40:56 +02:00
parent fa38ad3a74
commit 64e039cf8f
2 changed files with 16 additions and 3 deletions

View File

@@ -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();