date_time_picker
date_time_picker copied to clipboard
Accessing the value using the controller as you would do with a TextField returns a non formatted value
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?
Should I do something like DateFormat(myDateFormat).format(DateTime.parse(myController.value.text))?