From a7df265092f354f453b271c18b99f346538e6286 Mon Sep 17 00:00:00 2001 From: Michel Vidailhet Date: Thu, 28 Apr 2016 17:21:16 +0200 Subject: [PATCH] Fixed "Invalid parameter not satisfying: date" error on iOS at the second opening of the date picker --- src/ios/DatePicker.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ios/DatePicker.m b/src/ios/DatePicker.m index caae145..c4297fb 100644 --- a/src/ios/DatePicker.m +++ b/src/ios/DatePicker.m @@ -240,8 +240,15 @@ - (void)updateDatePicker:(NSMutableDictionary *)options { if(maxDateString && maxDateString.length > 0){ self.datePicker.maximumDate = [formatter dateFromString:maxDateString]; } - - self.datePicker.date = [formatter dateFromString:dateString]; + + @try{ + self.datePicker.date = [formatter dateFromString:dateString]; + } @catch (NSException *exception) { + NSLog(@"Write failed with error: %@", exception); + NSString *dateS; + dateS = [formatter stringFromDate:[NSDate date]]; + self.datePicker.date = [formatter dateFromString:dateS]; + } if ([mode isEqualToString:@"date"]) { self.datePicker.datePickerMode = UIDatePickerModeDate;