Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'DateTime' is not a subtype of type 'TimeOfDay' #131

Closed
michael-golfi opened this issue Sep 8, 2019 · 2 comments
Closed

'DateTime' is not a subtype of type 'TimeOfDay' #131

michael-golfi opened this issue Sep 8, 2019 · 2 comments

Comments

@michael-golfi
Copy link

I'm seeing 'DateTime' is not a subtype of type 'TimeOfDay' when I use a DateTimePickerFormField with time only option and clicking cancel on the time picker.

It seems that the error is happening at line 324 because currentValue is DateTime and DateTimeField.convert is expecting a TimeOfDay:

return DateTimeField.convert(await _showTimePicker(context, currentValue) ?? currentValue);
@michael-golfi
Copy link
Author

I seemed to have fixed it by replacing the line with:

return DateTimeField.convert(await _showTimePicker(context, currentValue) ?? TimeOfDay.fromDateTime(currentValue));

@danvick
Copy link
Collaborator

danvick commented Sep 11, 2019

Hi @michael-golfi,
Thanks for bringing this to my attention, the fix for this has been published in version 3.5.3.

@danvick danvick closed this as completed Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants