This is a migrated thread and some comments may be shown as answers.

Bug: month calendar with equalWeekNumber = NO fails to display whole months

7 Answers 80 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mathieu
Top achievements
Rank 1
Mathieu asked on 03 Sep 2015, 08:29 AM

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

Sort by
0
Jack
Telerik team
answered on 03 Sep 2015, 11:25 AM
Hi Mathieu,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mathieu
Top achievements
Rank 1
answered on 03 Sep 2015, 01:21 PM

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.

0
Mathieu
Top achievements
Rank 1
answered on 03 Sep 2015, 01:59 PM

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.

0
Jack
Telerik team
answered on 04 Sep 2015, 08:49 AM
Hello Mathieu,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mathieu
Top achievements
Rank 1
answered on 04 Sep 2015, 10:03 AM

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.

0
Mathieu
Top achievements
Rank 1
answered on 04 Sep 2015, 10:31 AM
Here is a screenshot how it looks like for me
0
Jack
Telerik team
answered on 04 Sep 2015, 12:03 PM
Hi Mathieu,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Mathieu
Top achievements
Rank 1
Answers by
Jack
Telerik team
Mathieu
Top achievements
Rank 1
Share this question
or