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

8 posts, 0 answers
  1. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 03 Sep 2015 Link to this post

    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.

  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 03 Sep 2015 Link to this post

    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
  3. DevCraft banner
  4. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 03 Sep 2015 Link to this post

    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.

  5. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 03 Sep 2015 Link to this post

    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.

  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 04 Sep 2015 Link to this post

    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
  7. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 04 Sep 2015 Link to this post

    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.

  8. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 04 Sep 2015 Link to this post

    Here is a screenshot how it looks like for me
  9. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 04 Sep 2015 Link to this post

    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
Back to Top
DevCraft banner