-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
January not shown for some years in en_GB #18
Comments
Looking further into this, it also affects 2011 and 2012, but not 2009 or 2008. Not sure what makes them different. I notice there's a comment in the code: // -[NSDateComponents weekOfYear] doesn't explicitly specify what its valid range is. In the Gregorian case, it appears to be [1,52], which means the last day of December is probably going to be week 1 of next year. The same logic extends to other calendars. so I added this code to if ((section == 480) || (section == 504))
{
NSLog(@"section %d", section);
NSLog(@"firstWeek %d", firstWeek);
NSLog(@"nextToLastWeek %d", nextToLastWeek);
NSRange range;
range = [self.calendar minimumRangeOfUnit:NSWeekOfYearCalendarUnit];
NSLog(@"minimumRangeOfUnit:[%d, %d]", range.location, range.location + range.length - 1);
range = [self.calendar maximumRangeOfUnit:NSWeekOfYearCalendarUnit];
NSLog(@"maximumRangeOfUnit:[%d, %d]", range.location, range.location + range.length - 1);
range = [self.calendar rangeOfUnit:NSWeekOfYearCalendarUnit inUnit:NSYearCalendarUnit forDate:firstOfMonth];
NSLog(@"rangeOfUnit:inUnit:[%d, %d]", range.location, range.location + range.length - 1);
} I got this output:
Hopefully that's useful in figuring out the valid range. I also found that I can work around the problem by adding this just before the return: if (firstWeek > nextToLastWeek)
{
// The first week must have been the end of last year.
firstWeek = 0;
} but I'm not sure I understand what I've done well enough to say that that's fixed the problem. I could still put it in a pull request, if you'd like (I've signed the CLA for KIF - do I need to sign it again for TS?). |
I have a calendar view which I set up like so:
C3CCalendarRowCell
just defines some images, as per the example app. When I scroll to the start of 2010, I see this:Looking in the debugger, I see that something weird is going in inside
-[tableView:numberOfRowsInSection:]
.firstWeek
is 3, butnextToLastWeek
is 53, so that section has minus 47 rows.Could this be because my calendar locale is
en_GB
? It's possible we have different rules about week numbers in Britain; I have no idea.The text was updated successfully, but these errors were encountered: