Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions ios/fabric/RNDateTimePickerComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if (minuteInterval <= 0) {
return minimumDate;
}

NSInteger minute = [[NSCalendar currentCalendar] component:NSCalendarUnitMinute fromDate:minimumDate];
NSInteger remainder = minute % minuteInterval;
NSInteger adjustment = (remainder == 0) ? 0 : (minuteInterval - remainder);
Expand Down Expand Up @@ -175,12 +175,20 @@ - (Boolean)updatePropsForPicker:(UIDatePicker *)picker props:(Props::Shared cons
}

if (oldPickerProps.minimumDate != newPickerProps.minimumDate) {
NSDate *minimumDate = convertJSTimeToDate(newPickerProps.minimumDate);
picker.minimumDate = adjustMinimumDate(minimumDate, newPickerProps.minuteInterval);
if (newPickerProps.minimumDate == 0.0) {
picker.minimumDate = nil;
} else {
NSDate *minimumDate = convertJSTimeToDate(newPickerProps.minimumDate);
picker.minimumDate = adjustMinimumDate(minimumDate, newPickerProps.minuteInterval);
}
}

if (oldPickerProps.maximumDate != newPickerProps.maximumDate) {
picker.maximumDate = convertJSTimeToDate(newPickerProps.maximumDate);
if (newPickerProps.maximumDate == 0.0) {
picker.maximumDate = nil;
} else {
picker.maximumDate = convertJSTimeToDate(newPickerProps.maximumDate);
}
}

if (oldPickerProps.locale != newPickerProps.locale) {
Expand Down Expand Up @@ -313,4 +321,3 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &
{
return RNDateTimePickerComponentView.class;
}