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

Commit

Permalink
fix(dayView): correctly display events that finish within 1 hour afte…
Browse files Browse the repository at this point in the history
…r the day view end

Closes #302
  • Loading branch information
Matt Lewis committed Mar 11, 2016
1 parent dd6f010 commit 3fc4104
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/calendarHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ angular
var dayEndHour = moment(dayViewEnd || '23:00', 'HH:mm').hours();
var hourHeight = (60 / dayViewSplit) * 30;
var calendarStart = moment(viewDate).startOf('day').add(dayStartHour, 'hours');
var calendarEnd = moment(viewDate).startOf('day').add(dayEndHour, 'hours');
var calendarEnd = moment(viewDate).startOf('day').add(dayEndHour + 1, 'hours');
var calendarHeight = (dayEndHour - dayStartHour + 1) * hourHeight;
var hourHeightMultiplier = hourHeight / 60;
var buckets = [];
Expand Down
7 changes: 7 additions & 0 deletions test/unit/services/calendarHelper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ describe('calendarHelper', function() {
}, {
startsAt: new Date('October 20, 2015 11:00:00'),
endsAt: new Date('October 20, 2015 12:00:00')
}, {
startsAt: new Date('October 20, 2015 22:00:00'),
endsAt: new Date('October 20, 2015 23:30:00')
}];

dayView = calendarHelper.getDayView(
Expand Down Expand Up @@ -552,6 +555,10 @@ describe('calendarHelper', function() {
expect(dayView[2].height).to.equal(60);
});

it('should set the height correctly of events that finish within an hour after the day view end', function() {
expect(dayView[3].height).to.equal(90);
});

it('should never exceed the maximum height of the calendar', function() {
expect(dayView[0].height).to.equal(1440);
});
Expand Down

0 comments on commit 3fc4104

Please sign in to comment.