dylanwuzh / flutter-cupertino-date-picker

Flutter cupertino style date picker.
Apache License 2.0
363 stars 414 forks source link

if initialDateTime and minDateTime is same, format 'yyyy-MM-dd HH:mm' have bug #125

Open Wait1997 opened 3 years ago

Wait1997 commented 3 years ago

如果现在的时间是晚上19:18,那么格式化为 yyyy-MM-dd HH:mm 后 19时的minute将只有01到41

tanlianghao commented 3 years ago

同样有遇到,有解决办法吗

ahmadkhedr commented 3 years ago

Same Here

ahmadkhedr commented 3 years ago

I solved it to prevent the picker from opening if the min and max dates are the same...it works fine and it does the purpose because there is no need to open the date picker if you can not choose any dates but one

if(minDateTime.compareTo(maxDateTime) < 0){
 DatePicker.showDatePicker(
       context,
..............
 );
}

Change the minDateTime & max DateTime with the variable names you are using in the code.

carrot1994 commented 3 years ago

如果选择当前到未来一个月的时间段,那么当前时间跟minDateTime势必是一样的。这样的话,分钟会显示为0而不会显示当前分钟数,请问该怎么办呢