date_time_picker icon indicating copy to clipboard operation
date_time_picker copied to clipboard

Accessing the value using the controller as you would do with a TextField returns a non formatted value

Open DavideBicego opened this issue 3 years ago • 1 comments

DateTimePicker(
  controller: myController,
  dateMask: myDateFormat,
  initialDate: DateTime.now(),
  firstDate:
      DateTime.now().subtract(Duration(days: 365)),
  lastDate: DateTime.now().add(Duration(days: 365)),
)

Retrieving the value via myController.value.text returns the value in Y-m-d format even though myDateFormat has a different value. Is this by design? How should I retrieve the value of the TextField?

DavideBicego avatar May 30 '22 12:05 DavideBicego

Should I do something like DateFormat(myDateFormat).format(DateTime.parse(myController.value.text))?

DavideBicego avatar May 30 '22 13:05 DavideBicego