Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Date parameter in MonthViewDayTapped is wrong.
posted

Hi,

I'm subscribing to the monthViewDayTapped event handler which has two parameters, IGCalendarView calView and NSDate date. the date parameter is always a day ahead of the calendar day I have tapped.

I am based in the uk and working with a group of developers in the US so presume its a time zone issue although its always the next day even when my colleagues are in the same day as myself.

Any help would be greatly appreciated.

Cheers,

Matt

 

Parents
No Data
Reply
  • 48586
    posted

    Hello ,

     

    When your environment is localized for UK environment, date parameters returns you the tapped date localized with your environment current localization settings. So if you want to get the true date you should use code like:

     

    -(BOOL)calendarView:(IGCalendarView *)calView monthViewDayTapped:(NSDate *)date

    {

        NSCalendar* calendar = [NSCalendar currentCalendar];

        NSDateComponents* comps = [calendar components:NSYearCalendarUnit |NSMonthCalendarUnit | NSDayCalendarUnit  fromDate:date];

        NSLog(@"Value of date is %d/%d/%d", comps.month, comps.day, comps.year);

        return YES;

    }

     

    Please let me know if you have any further questions. 

    140554Monthview 1.zip
Children