django-rest-framework
django-rest-framework copied to clipboard
DateTimeField raises NonExistentTimeError/AmbiguousTimeError during validation.
Checklist
- [x] I have verified that that issue exists against the
masterbranch of Django REST framework. - [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- [x] This is not a usage question. (Those should be directed to the discussion group instead.)
- [x] This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
- [x] I have reduced the issue to the simplest possible case.
- [x] I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)
Steps to reproduce
- Intall
pytz(along with Django and django-rest-framwork); - Set settings.TIME_ZONE = 'America/New_York';
- Make a serializor with DateTimeField;
- Try to serialize '2017-03-12T02:30:00'.
or
- Execute DateTimeField(default_timezone=pytz.timezone('America/New_York')).to_internal_value('2017-03-12T02:30:00')
Expected behavior
ValidationError raised with appropriate message.
Actual behavior
NonExistentTimeError/AmbiguousTimeError propagated from pytz.
Good catch, indeed it should return a ValidationError
Okay, since #4987 is merged do we still have addressing AmbiguousTimeError to resolve, or are we done here?
From my understanding we're all set here, feel free to close this one