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
No problem!
Glad we were able to clear things up.
-SteveZ
Yep, you are right, looks like it's Xamarins fault, not IG - Apologies for getting on at you guys.
Hey Fergal,
Sure.
Here's the actual code: (translated to C#) that we're using to create the date thats passed in:
NSCalendar calendar = NSCalendar.CurrentCalendar; NSDateComponents comps = new NSDateComponents (); comps.Month = 7; comps.Day = 4; comps.Year = 2014; NSDate d = calendar.DateFromComponents (comps);
(Note the same exact problem arises)
Hmm. That seems really strange - I could understand it displaying the data wrong in intellisense somehow, but I would expect that the code would still work fine - however it is not.
Let me investigate further, see if I can replicate this in Xamarin alone (without IG components). If so, its probably their problem.
Thanks
Fergal
Actually, thats the problem you're seeing.
I just tried it out in Xamarin. The difference just appears to be the value displayed in the Watch windows. In objective-c it will display the correct date, with no time. It appears that Xamarin is displaying the description, of the date, which is a time localized version of it.
However, the date object is still in tact, and you can still get the correct date information:
NSCalendar calendar = NSCalendar.CurrentCalendar;NSDateComponents comps = calendar.Components (NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day | NSCalendarUnit.Hour, date);
In the code snippet above, i also added the Hour unit. If you take a look at it, you'll see that the hour you're actually getting is 0, which is the neutral time we're giving you.