Skip to content

Commit

Permalink
Fixed a bug preventing the “next month” button from working on Januar…
Browse files Browse the repository at this point in the history
…y 29th or 30th.
  • Loading branch information
MosheBerman committed Aug 6, 2014
1 parent 98e88cf commit 8cdc4ed
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions MBCalendarKit/CalendarKit/Core/CKCalendarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,9 @@ - (void)forwardTapped

// Otherwise, add a month and then go to the first of the month
else{
NSUInteger day = [[self calendar] daysInDate:date];
date = [[self calendar] dateByAddingMonths:1 toDate:date]; // Add a month
date = [[self calendar] dateBySubtractingDays:day-1 fromDate:date]; // Go to the first of the month
NSUInteger day = [[self calendar] daysInDate:date]; // Only then go to the first of the next month.
date = [[self calendar] dateBySubtractingDays:day-1 fromDate:date];
}

// If today is in the visible month, jump to today
Expand Down Expand Up @@ -902,9 +902,8 @@ - (void)backwardTapped

if ([self displayMode] == CKCalendarViewModeMonth) {

NSUInteger day = [[self calendar] daysInDate:date];

date = [[self calendar] dateBySubtractingMonths:1 fromDate:date]; // Subtract a month
NSUInteger day = [[self calendar] daysInDate:date];
date = [[self calendar] dateBySubtractingDays:day-1 fromDate:date]; // Go to the first of the month

// If today is in the visible month, jump to today
Expand Down

0 comments on commit 8cdc4ed

Please sign in to comment.