Skip to content

Commit

Permalink
Fix bug show days of month for 31 days
Browse files Browse the repository at this point in the history
  • Loading branch information
Husseinhj committed Nov 11, 2017
1 parent b5adc8c commit 2b9efe4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ios_calendar/Sources/CalendarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,11 @@ - (void) generatePersianDayRects{
NSInteger plusRow = startDayOfMonth == 7?2:1;
NSInteger weeks = (lastDayOfMonth / 7)+plusRow;
NSInteger minimumDayOfWeek = 1;
startDayOfMonth = kCalendarViewDaysInWeek - (startDayOfMonth-1);

if (startDayOfMonth > 0) {
startDayOfMonth = kCalendarViewDaysInWeek - (startDayOfMonth-1);
} else {
startDayOfMonth = kCalendarViewDaysInWeek;
}
NSMutableArray *daysOfMonth = [[NSMutableArray alloc] init];
for (int i = 1; i <= weeks; i++) {
NSMutableArray *arrayOfEachWeek = [[NSMutableArray alloc] init];
Expand All @@ -458,7 +461,7 @@ - (void) generatePersianDayRects{
[components setDay:currentDay];
currentDate = [calendar dateFromComponents:components];
NSInteger weekday = [currentDate getWeekdayOfFirstDayOfMonthForCalendar:calendar];

weekday = weekday == 0 ? 1:weekday;
const CGFloat yOffSet = [self getEffectiveDaysYOffset];
const CGFloat w = self.dayCellWidth;
const CGFloat h = self.dayCellHeight;
Expand Down

0 comments on commit 2b9efe4

Please sign in to comment.