This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)configDatePicker:(UIDatePicker *)datePicker{ | |
datePicker.backgroundColor = [UIColor whiteColor]; | |
// Round Default date with 15 mins interval | |
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSMinuteCalendarUnit fromDate:[NSDate date]]; | |
NSInteger minutes = [dateComponents minute]; | |
NSInteger minutesRounded =roundf((float)minutes / (float)30 + 0.5) * 30; | |
NSDate *roundedDate = [[NSDate alloc] initWithTimeInterval:60.0 * (minutesRounded - minutes) sinceDate:[NSDate date]]; | |
[datePicker setMinimumDate:roundedDate]; |