m3uzz / date_time_picker

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.
https://pub.dartlang.org/packages/date_time_picker
Other
105 stars 157 forks source link

DateTime type date not changing #59

Open hasnainusti opened 2 years ago

hasnainusti commented 2 years ago

I'm using DateTimePicker with type datetime. It was working fine but after upgrading flutter date stop changing. When I choose type only to date it works but when i chosse datetime date does not change but time changes.

AndreLuizNogueira commented 1 week ago

I just had this issue and first I traced it to the focusnode, removing the focus solved it... then debugging this library I found that in date_time_picker.dart, on line 844 it gets the correct date, but since it's a global variable it's getting updated back to the original date when it calls showTimePicker... since I didn't want to spend too much time on this I just added another local variable "String selectedDate = '';" on line 845, on line 850 I set it to "selectedDate = _sDate;" and on line 900 I replaced sDate with selectedDate;

below are the changes

image