I need to schedule a notification. If the date made from the current date date components with the dateFromData time components is early than the current day, I would like to change it to the next day. Here is what I have so far. The date comparison dose not work no matter how I set it. It either always changes it or never changes it.
var dateComps = calendar.components(NSCalendarUnit.YearCalendarUnit | NSCalendarUnit.MonthCalendarUnit | NSCalendarUnit.DayCalendarUnit | NSCalendarUnit.HourCalendarUnit | NSCalendarUnit.MinuteCalendarUnit, fromDate: NSDate())
dateComps.hour = calendar.component(NSCalendarUnit.HourCalendarUnit, fromDate: dateFromData)
dateComps.minute = calendar.component(NSCalendarUnit.MinuteCalendarUnit, fromDate: dateFromData)
if fireDate.compare(NSDate()) == NSComparisonResult.OrderedDescending {
//change day to next day
dateComps.day += 1
println("Change day")
}else{
println("Do not change day")
}
let notifactionOfAmountOfWork = UILocalNotification()
notifactionOfAmountOfWork.category = "normalNotifactionCatagory"
notifactionOfAmountOfWork.fireDate = calendar.dateFromComponents(dateComps)