diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c242e50..c8cac15b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). --- +## Current - 2018-08-28 + +- Added support for events having a duration instead of an end. + ## [2.4.1] - 2018-07-04 ### Fixed diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index e3b53b0b..e8db5a95 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,7 +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; }