NSCalendar *cal = [NSCalendar currentCalendar];
NSDateComponents *sleepComps = [cal components:NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:se.sleepDate];
NSDateComponents *wakeUpComps = [cal components:NSHourCalendarUnit | NSMinuteCalendarUnit fromDate:se.wakeUpDate];
date = [_displayDate startDayDate];
if (sleepComps.hour > wakeUpComps.hour)
date = [date dateByAddingTimeInterval:-86400];
沒有留言:
張貼留言