diff options
Diffstat (limited to 'django/forms/utils.py')
| -rw-r--r-- | django/forms/utils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/forms/utils.py b/django/forms/utils.py index fbe79f1142..50412f414b 100644 --- a/django/forms/utils.py +++ b/django/forms/utils.py @@ -161,6 +161,11 @@ def from_current_timezone(value): if settings.USE_TZ and value is not None and timezone.is_naive(value): current_timezone = timezone.get_current_timezone() try: + if ( + not timezone._is_pytz_zone(current_timezone) and + timezone._datetime_ambiguous_or_imaginary(value, current_timezone) + ): + raise ValueError('Ambiguous or non-existent time.') return timezone.make_aware(value, current_timezone) except Exception as exc: raise ValidationError( |
