Skip to content

Commit e43622d

Browse files
author
Solera
committed
Set currentDate to be the smaller value date from the passed props.
1 parent 56cc719 commit e43622d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/DateTimePickerModal.ios.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ export class DateTimePickerModal extends React.PureComponent {
7272

7373
static getDerivedStateFromProps(props, state) {
7474
if (props.isVisible && !state.isPickerVisible) {
75-
return { currentDate: props.date, isPickerVisible: true };
75+
if (props.date < props.minimumDate) {
76+
console.warn(
77+
"The date property shouldn't be prior to be the minimum date"
78+
);
79+
}
80+
const smallerDateValue =
81+
props.date >= props.minimumDate ? props.date : props.minimumDate;
82+
return { currentDate: smallerDateValue, isPickerVisible: true };
7683
}
7784
return null;
7885
}

0 commit comments

Comments
 (0)