Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix: dont modify the events array

Closes #491
  • Loading branch information...
Matt Lewis
Matt Lewis committed Nov 13, 2016
1 parent d5f8f61 commit 8b39c31aecf32145263d10d6d9e497d68ee599e1
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/directives/mwlCalendar.js
@@ -40,7 +40,7 @@ angular
var previousDate = moment(vm.viewDate);
var previousView = vm.view;

function eventIsValid(event) {
function checkEventIsValid(event) {
if (!event.startsAt) {
$log.warn(LOG_PREFIX, 'Event is missing the startsAt field', event);
} else if (!angular.isDate(event.startsAt)) {
@@ -55,8 +55,6 @@ angular
$log.warn(LOG_PREFIX, 'Event cannot start after it finishes', event);
}
}

return true;
}

function refreshCalendar() {
@@ -65,9 +63,9 @@ angular
vm.viewTitle = calendarTitle[vm.view](vm.viewDate);
}

vm.events = vm.events.filter(eventIsValid).map(function(event, index) {
vm.events.forEach(function(event, index) {
checkEventIsValid(event);
event.calendarEventId = index;
return event;
});

//if on-timespan-click="calendarDay = calendarDate" is set then don't update the view as nothing needs to change

0 comments on commit 8b39c31

Please sign in to comment.
You can’t perform that action at this time.