added support for events having a duration instead of an end

This commit is contained in:
vlb 2018-08-28 17:29:42 +02:00
parent 7ba88a83f0
commit c755c823fa
2 changed files with 8 additions and 1 deletions

View File

@ -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 ## [2.4.1] - 2018-07-04
### Fixed ### Fixed

View File

@ -90,6 +90,9 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
var endDate; var endDate;
if (typeof event.end !== "undefined") { if (typeof event.end !== "undefined") {
endDate = eventDate(event, "end"); endDate = eventDate(event, "end");
} else if(typeof event.duration !== "undefined") {
dur=moment.duration(event.duration);
endDate = startDate.clone().add(dur);
} else { } else {
if (!isFacebookBirthday) { if (!isFacebookBirthday) {
endDate = startDate; endDate = startDate;
@ -273,7 +276,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
var start = event.start || 0; var start = event.start || 0;
var startDate = new Date(start); var startDate = new Date(start);
var end = event.end || 0; 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. // Is 24 hours, and starts on the middle of the night.
return true; return true;
} }