Realank / flutter_datetime_picker

a date time picker in flutter
MIT License
615 stars 728 forks source link

Is there a way to provide a maximum pickable time in DatePicker.showDateTimePicker? #151

Open macmatrix opened 4 years ago

macmatrix commented 4 years ago

I would like to limit the user to pick a TIME within a range. I wrote the following code and it seems to apply a minimum time but it does not apply a maximum time

FlatButton(
  onPressed: () {
    DatePicker.showDateTimePicker(context,
    showTitleActions: true,
    minTime: DateTime(year, month, day, hour, minute),
    maxTime: DateTime(year, month, day, hour + 3, 0),
    currentTime: DateTime.now(), locale: LocaleType.en);
  },
  child: Text('show date time picker')
)
MRX151 commented 4 years ago

same as you,a bug maybe.

raLaaaa commented 4 years ago

I'm using the same code but I'm limitting the year. That does work for me though.