Bug Description
The Picker reuses the time portion of a given DateTime if a use doesn't select a time. This can cause it to return an invalid DateTime if the user selected the earliest or latest possible date. Upon attempting to reopen the picker, the picker will crash, complaining that the _selectedDateTime is before or after the specified minimum or maximum DateTime.
Reproduction Steps
- Set
DateTime.now().subtract(Duration(days: 7)) as the minimumDateTime.
- Set
DateTime.now().subtract(Duration(minutes: 10)) as the initialDateTime.
- Select the earliest possible day (7 days ago) in the picker.
- Reopen the picker.
- Error.
Supposed solution
Picker should either disallow selecting an invalid DateTime or constrain the selection to be within the minimum and maximum.