flutter_datetime_picker icon indicating copy to clipboard operation
flutter_datetime_picker copied to clipboard

showDateTimePicker max limit for hour is not setting for the same day,

Open aifrosals opened this issue 4 years ago • 8 comments

if I set the min and max time like this for showDateTimePicker

 minTime: DateTime(2020,10,26,12,0),
 maxTime: DateTime(2020,10,26,19,59),

it gives me the min time of 12th hour but it is still giving me 23:59 for the maxTime, although I set it to 19.59

aifrosals avatar Oct 26 '20 11:10 aifrosals

Is there a workaround or fix?

pawangjain avatar Dec 01 '20 06:12 pawangjain

i have the same problem, when the set time interval is less than one day

JunevaYang avatar Dec 21 '20 06:12 JunevaYang

@JunevaYang Did you find a workaround?

racknoris avatar Dec 21 '20 07:12 racknoris

@JunevaYang Did you find a workaround?

not

JunevaYang avatar Dec 21 '20 07:12 JunevaYang

@JunevaYang You can use this fork: https://github.com/yu3fms/flutter_datetime_picker He solved this problem, I used it and it works great

racknoris avatar Dec 21 '20 14:12 racknoris

@JunevaYang You can use this fork: https://github.com/yu3fms/flutter_datetime_picker He solved this problem, I used it and it works great

thx

JunevaYang avatar Dec 21 '20 15:12 JunevaYang

I tried the fork: https://github.com/yu3fms/flutter_datetime_picker with the below code.

But the maxTime does not restrcit the time to plus 4 hours. It shows till the midnight of the same day.

DatePicker.showDateTimePicker(
        context,
        showTitleActions: true,
        minTime: DateTime.now(),
        maxTime: DateTime.now().add(Duration(
          hours: 4,
        )),
        onChanged: (date) {
          print('change $date');
        },
        onConfirm: (date) {
          print('confirm $date');
        },
        currentTime: DateTime.now(),
        locale: LocaleType.en,
      );
    },
    child: Text(
      'Select Time within 4 Hours',
    ));

Is there anything i am missing or doing wrong?

pawangjain avatar Dec 22 '20 11:12 pawangjain

Hey guys it is still not working for me, has anyone found the solution?

trinanda98 avatar Mar 27 '21 03:03 trinanda98