diff --git a/CHANGELOG.md b/CHANGELOG.md index aa7956a75f..bcc063b74e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Hungarian translation for "Feels" and "Week" - Spanish translation for "Feels" - Add classes instead of inline style to the message from the module Alert +- Support for events having a duration instead of an end +- Support for showing end of events through config parameters showEnd and dateEndFormat ### Fixed - Mixup between german and spanish translation for newsfeed. @@ -31,6 +33,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Hungarian translations for the updatenotification module - Updated Norsk bokmål translation - Updated Norsk nynorsk translation +- Consider multi days event as full day events ## [2.4.1] - 2018-07-04 diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index ebfc4c1431..3bb5a03b6c 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -25,7 +25,9 @@ Module.register("calendar", { urgency: 7, timeFormat: "relative", dateFormat: "MMM Do", + dateEndFormat: "HH:mm", fullDayEventDateFormat: "MMM Do", + showEnd: true, getRelative: 6, fadePoint: 0.25, // Start on 1/4th of the list. hidePrivate: false, @@ -287,6 +289,10 @@ Module.register("calendar", { timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()); } } + if(this.config.showEnd){ + timeWrapper.innerHTML += "-" ; + timeWrapper.innerHTML += this.capFirst(moment(event.endDate , "x").format(this.config.fullDayEventDateFormat)); + } } else { if (event.startDate >= new Date()) { if (event.startDate - now < 2 * oneDay) { @@ -329,6 +335,11 @@ Module.register("calendar", { }) ); } + if (this.config.showEnd) { + timeWrapper.innerHTML += "-"; + timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat)); + + } } //timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll'); //console.log(event); diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index ccd1f6c8aa..e8db5a95cd 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -90,6 +90,9 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri var endDate; if (typeof event.end !== "undefined") { endDate = eventDate(event, "end"); + } else if(typeof event.duration !== "undefined") { + dur=moment.duration(event.duration); + endDate = startDate.clone().add(dur); } else { if (!isFacebookBirthday) { endDate = startDate; @@ -273,8 +276,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri var start = event.start || 0; var startDate = new Date(start); var end = event.end || 0; - - if (end - start === 24 * 60 * 60 * 1000 && startDate.getHours() === 0 && startDate.getMinutes() === 0) { + if (((end - start) % (24 * 60 * 60 * 1000)) === 0 && startDate.getHours() === 0 && startDate.getMinutes() === 0) { // Is 24 hours, and starts on the middle of the night. return true; }