Hi,
I have a calendar with mode = TKCalendarViewModeMonth and presenter.equalWeekNumber = NO. As far as I understand, this calendar should always show enough rows to display the current month completely, but no more rows than necessary. However, there are many cases in which the current months is truncated (e.g. November 2015 ends on the 29th, January 2016 ends on the 24th, April 2016 ends on the 24th, May 2016 ends on the 29th, ...).
This basically means that currently, equalWeekNumber = NO is totally unusable.
7 Answers, 1 is accepted
Thank you for contacting us.
I am not sure that I correctly understand your concerns. The equalWeekNumber property is useful when you want the calendar to show only rows which contain dates from the current month. For example when you set this property to YES, TKCalendar will always display 6 rows. If this property is set to NO, TKCalendar will display less rows depending from the currently displayed month. For example April 2016 ends on the 5th row and May 2016 ends on the 6th row. In my calendar November 2015 ends on 30th.
I hope this helps. I will be glad to assist you further if you have any specific questions.
Regards,
Jack
Telerik
Hi Jack,
your description fits my expectation of the calendars behavior, but my calendar does not behave that way. It does not display enough rows to display the mentioned months completely. E.g. for April 2016, I only get 4 rows and thus the last week of April is missing. The calendar has to be big enough to display 5 rows because it displays 5 rows in other months, so that can't be the issue.
Let me know which information I can provide to help reproducing this issue.
Update: I can tell you that (for April 2016) the following
NSDateComponents *comps = [self.calendar.calendar components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay fromDate:self.calendar.displayedDate];
comps.month += 1;
comps.day = 0;
NSDate *lastDayInMonth = [self.calendar.calendar dateFromComponents:comps];
result in April 29 2016, 22:00 UTC and
[self.calendar.calendar components:NSCalendarUnitWeekOfMonth fromDate:lastDayInMonth].weekOfMonth
returns 4.
Obviously both are wrong. Interestingly, my time zone is UTC+2h so it looks like localized and UTC dates are mixed up somewhere.
Thank you for this update.
Now I understand the issue. However, I was not able to reproduce it with local tests. Could you, please send us a sample project where the issue can be reproduced. This will help us to locate the issue and provide you with a proper solution.
I am looking forward to your reply.
Regards,
Jack
Telerik
Hi Jack,
to reproduce, do the following:
1) Initialize calendar like the following:
self.calendar = [[TKCalendar alloc] initWithFrame:self.view.frame];
self.calendar.viewMode = TKCalendarViewModeMonth;
self.calendar.maxDate = nil;
TKCalendarMonthPresenter *presenter = (TKCalendarMonthPresenter *)self.calendar.presenter;
presenter.equalWeekNumber = NO;
[self.view addSubview:self.calendar];
2) In the settings of your iPhone simulator, set General > Language and Region > Region to "Germany"
3) In your calendar, navigate to (for example) April 2016. It will display only 4 rows.
Thank you for the detailed description of this issue. We were able to reproduce it now. The problem appears to be the components:fromDate: method of TKCalendar which returns wrong week number in this scenario:
NSInteger
weeks = [calendar
components
:
NSCalendarUnitWeekOfMonth
fromDate
:lastDayInMonth]
.weekOfMonth
;
I updated your Telerik points for bringing this issue to our attention. Here is a link to our feedback portal where I logged the issue. We will address it in our upcoming release scheduled for the end of September. I hope this time frame is OK for you.
Should you have other questions, feel free to contact us.
Regards,
Jack
Telerik