You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While implementing MBCalendarKit in my project and using a week view, I noticed a bug - where sometimes pressing next/previous buttons (to switch to forwards/backwards week), it sometimes skips a week.
To Reproduce
I could easily reproduce this problem using provided demo. In Objective-C Calendar Control -> week view and
Animated Week Transitions.
Steps to reproduce the behaviour skipping a week when pressing next button:
Open a week view
Click on the LAST date of the visible week (and notice the date)
Press next button
See that visibly a week has been skipped
Steps to reproduce the behaviour skipping a week when pressing previous button:
Open a week view
Click on the FIRST date of the visible week (and notice the date)
Press previous button
See that visibly a week has been skipped
The issue is not reproducable, if, before pressing any button - first/last date is not selected.
Expected behavior
I would expect a week not to be skipped.
Additional context
Tested on iPhone 7, iOS 12
Possible fixes
I found a possible solution that works for me.
For backward button, I added an extra code before this line:
date = [self.calendar dateBySubtractingWeeks:1fromDate:date]; // Add a week
Code: date = [self.calendar lastDayOfTheWeekUsingReferenceDate:date];
(Basically I set the date as the last day of the visible week, thus making sure that a week will not be skipped)
For forward button, I added an extra code before this line:
Code: date = [self.calendar firstDayOfTheWeekUsingReferenceDate:date];
(Basically I set the date as the first day of the visible week, thus making sure that a week will not be skipped)
The text was updated successfully, but these errors were encountered:
Describe the bug
While implementing MBCalendarKit in my project and using a week view, I noticed a bug - where sometimes pressing next/previous buttons (to switch to forwards/backwards week), it sometimes skips a week.
To Reproduce
I could easily reproduce this problem using provided demo. In Objective-C Calendar Control -> week view and
Animated Week Transitions.
Steps to reproduce the behaviour skipping a week when pressing next button:
Steps to reproduce the behaviour skipping a week when pressing previous button:
The issue is not reproducable, if, before pressing any button - first/last date is not selected.
Expected behavior
I would expect a week not to be skipped.
Additional context
Tested on iPhone 7, iOS 12
Possible fixes
I found a possible solution that works for me.
For backward button, I added an extra code before this line:
MBCalendarKit/MBCalendarKit/CalendarKit/Core/CKCalendarModel+HeaderViewSupport.m
Line 276 in 9c46b80
Code:
date = [self.calendar lastDayOfTheWeekUsingReferenceDate:date];
(Basically I set the date as the last day of the visible week, thus making sure that a week will not be skipped)
For forward button, I added an extra code before this line:
MBCalendarKit/MBCalendarKit/CalendarKit/Core/CKCalendarModel+HeaderViewSupport.m
Line 198 in 9c46b80
Code:
date = [self.calendar firstDayOfTheWeekUsingReferenceDate:date];
(Basically I set the date as the first day of the visible week, thus making sure that a week will not be skipped)
The text was updated successfully, but these errors were encountered: