Open andvalsol opened 10 months ago
Maybe I'm missing something but doesn't this defeat the purpose of having the date
prop?
Maybe I'm missing something but doesn't this defeat the purpose of having the
date
prop?
I've added a change in the PR, this change corresponds to the behaviour the datetime picker seems to work on iOS
I've changed the PR.
Will review soon. FYI, this can also be done directly outside of the library:
setState({
isPickerOpen: true, // var that drives the picker visibility
pickerDate: date > minimumDate ? date : minimumDate // `date` prop passed to the picker
})
yes, but, well I feel that by doing this the library would match the behaviour of the modal in iOS, also the warning is quite handy 😄
@mmazzarolo have you got the chance to review the changes?
Why isn't this being merged? This should be the default behavior.
Overview
For iOS if the user hasn't touched the picker, the default date is set to be the date when the picker was mounted, instead of setting the date to be the minimum date (if passed), else the current date should be selected, since the mounting of the date could be at 11:59pm and the re-render could have been at 12:00am.
Test Plan
1) Open the picker on iOS 2) Set the minimum date to be a different date from the current date. 3) The picker's selected date (when clicking confirm) the returned should be the minimum date as expected, also the picker should behave as usual when other actions are taken.