Comparando um NSDate com [NSDate date]
Estou tentando forçar um usuário a selecionar uma data no futuro com um seletor de datas. Obviamente, usei o método compare:, no entanto, quando eu faço o seguinte código, mesmo que seja a mesma data que [NSDate date], ele informa que executa a instrução if. Aqui está o meu código:
if ([datePicker.date compare:[NSDate date]] == NSOrderedAscending) // If the picked date is earlier than today
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hmm, this date is earlier than today"
message:@"The date you've selected is earlier than today's date, please pick another"
delegate:nil
cancelButtonTitle:@"Okay, I'll pick another"
otherButtonTitles:nil];
// Show the alert
[alert show];
// Release the alert
[alert release];
}