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

Commit

Permalink
fix(dayView): use correct height when the end is part of the way thro…
Browse files Browse the repository at this point in the history
…ugh an hour
  • Loading branch information
Matt Lewis committed Jul 27, 2016
1 parent e0c260c commit beb2d31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/services/calendarHelper.js
Expand Up @@ -314,7 +314,7 @@ angular
var dayViewStartM = moment(dayViewStart || '00:00', 'HH:mm');
var dayViewEndM = moment(dayViewEnd || '23:59', 'HH:mm');
var hourHeight = (60 / dayViewSplit) * 30;
return ((dayViewEndM.diff(dayViewStartM, 'hours') + 1) * hourHeight) + 2;
return ((dayViewEndM.diff(dayViewStartM, 'minutes') / 60) * hourHeight) + 3;
}

function loadTemplates() {
Expand Down
12 changes: 7 additions & 5 deletions test/unit/services/calendarHelper.spec.js
Expand Up @@ -586,15 +586,17 @@ describe('calendarHelper', function() {
});

describe('getDayViewHeight', function() {
var dayViewHeight;

beforeEach(function() {
dayViewHeight = calendarHelper.getDayViewHeight('01:00', '22:59', 10);
it('should calculate the height of the day view', function() {
var dayViewHeight = calendarHelper.getDayViewHeight('01:00', '22:59', 10);
expect(dayViewHeight).to.equal(3960);
});

it('should calculate the height of the day view', function() {
expect(dayViewHeight).to.equal(3962);
it('should support partial hours', function() {
var dayViewHeight = calendarHelper.getDayViewHeight('01:00', '22:29', 10);
expect(dayViewHeight).to.equal(3870);
});

});

describe('getWeekViewWithTimes', function() {
Expand Down

0 comments on commit beb2d31

Please sign in to comment.