I use the following function to check if a message has expired -
- (BOOL) hasExpired:(NSDate*)myDate
{
if(myDate == nil)
{
return false;
}
NSDate *now = [NSDate date];
return !([now compare:myDate] == NSOrderedAscending);
}
This works fine if I am comparing two different dates. However, it returns false if the message has expired earlier in the day today. Any ideas on how I might fix it?