Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
fix: display events on the day view that dont have end dates
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Lewis committed Dec 19, 2016
1 parent be5f1e5 commit e5c1660
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/services/calendarHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ angular

}

function updateEventForCalendarUtils(event, eventPeriod) {
event.start = eventPeriod.start.toDate();
if (event.endsAt) {
event.end = eventPeriod.end.toDate();
}
return event;
}

function getMonthView(events, viewDate, cellModifier) {

// hack required to work with the calendar-utils api
Expand All @@ -139,7 +147,7 @@ angular
start: moment(event.startsAt),
end: moment(event.endsAt || event.startsAt)
}, event.recursOn, moment(viewDate).startOf('month'));
angular.extend(event, eventPeriod);
updateEventForCalendarUtils(event, eventPeriod);
});

var view = calendarUtils.getMonthView({
Expand Down Expand Up @@ -196,10 +204,16 @@ angular
end: moment(event.endsAt || event.startsAt)
}, event.recursOn, weekViewStart);

eventPeriod.originalEvent = event;
var calendarUtilsEvent = {
originalEvent: event,
start: eventPeriod.start.toDate()
};

return eventPeriod;
if (event.endsAt) {
calendarUtilsEvent.end = eventPeriod.end.toDate();
}

return calendarUtilsEvent;
})
}).map(function(eventRow) {

Expand Down Expand Up @@ -227,8 +241,7 @@ angular
start: moment(event.startsAt),
end: moment(event.endsAt || event.startsAt)
}, event.recursOn, moment(viewDate).startOf('day'));
angular.extend(event, eventPeriod);
return event;
return updateEventForCalendarUtils(event, eventPeriod);
}),
viewDate: viewDate,
hourSegments: 60 / dayViewSplit,
Expand Down

0 comments on commit e5c1660

Please sign in to comment.