devinross / tapkulibrary

tap + haiku = tapku, a well crafted open source iOS framework
http://devinross.com/tapku/documentation
MIT License
3.9k stars 653 forks source link

Calendar crashing on EMT in November #198

Closed MCKRUZ closed 11 years ago

MCKRUZ commented 12 years ago

This is easily reproducible...

In the demo code change the "DemoCalendarMonth.m" class method to look like this...notice that the timezones are EMT. Also make sure that your current date on your computer is set to Nov 2nd. 2012.

- (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end{
    // this function sets up dataArray & dataDictionary
    // dataArray: has boolean markers for each day to pass to the calendar view (via the delegate function)
    // dataDictionary: has items that are associated with date keys (for tableview)

    NSLog(@"Delegate Range: %@ %@ %d",start,end,[start daysBetweenDate:end]);

    self.dataArray = [NSMutableArray array];
    self.dataDictionary = [NSMutableDictionary dictionary];

    NSDate *d = start;
    while(YES){

        int r = arc4random();
        if(r % 3==1){
            [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",@"Item two",nil] forKey:d];
            [self.dataArray addObject:[NSNumber numberWithBool:YES]];

        }else if(r%4==1){
            [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",nil] forKey:d];
            [self.dataArray addObject:[NSNumber numberWithBool:YES]];

        }else
            [self.dataArray addObject:[NSNumber numberWithBool:NO]];

        TKDateInformation info = [d dateInformationWithTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EMT"]];
        info.day++;
        d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneWithAbbreviation:@"EMT"]];
        if([d compare:end]==NSOrderedDescending) break;
    }

}
kreeger commented 12 years ago

I'm seeing this, too, in an application where I have the calendar implemented; exact same issue. I'm having to add an extra boolean to the array that I pass back in -calendarMonthView:marksFromDate:toDate: delegate method.

devinross commented 11 years ago

I added a timeZone property so you can change the time zone to whatever you'd like. Is this still a problem? I don't see it crash when viewing November 2012