I am trying to create some date objects.
var gregorian:NSCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)!;
var unit : NSCalendarUnit = (NSCalendarUnit.YearCalendarUnit|NSCalendarUnit.MonthCalendarUnit|NSCalendarUnit.DayCalendarUnit|NSCalendarUnit.HourCalendarUnit|NSCalendarUnit.MinuteCalendarUnit);
var interval:Double = Double(i)*60*60*24;
var tomorrow:NSDate = NSDate().dateByAddingTimeInterval(interval);
var comps:NSDateComponents = gregorian.components(unit, fromDate: tomorrow);
comps.setValue(17, forComponent: NSCalendarUnit.HourCalendarUnit);
var five_tomorrow : NSDate = gregorian.dateFromComponents(comps)!;
comps.setValue(19, forComponent: NSCalendarUnit.HourCalendarUnit);
var seven_tomorrow : NSDate = gregorian.dateFromComponents(comps)!;
comps.setValue(21, forComponent: NSCalendarUnit.HourCalendarUnit);
var nine_tomorrow : NSDate = gregorian.dateFromComponents(comps)!;
This seems to work fine on my iOS8 phone. But on my iOS7 device I print the dates and get 2015-03-03 19:33:00 MST
for all of the them. Any guesses as to why this is happening?
Edit: What I am trying to do is get the date for around 5:00, 7:00, 9:00, and 10:00 pm tomorrow to set a local notification. I don't care so much about the minutes.