diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2021-05-10 14:39:50 +0100 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-05-12 14:42:17 +0200 |
| commit | 46346f8ea08020d503b25472a26b949a5ce980a6 (patch) | |
| tree | 2ea5991cc8dc896fd2858ad1df51ae34655053ff /django/forms | |
| parent | 44accb066a51d15f27e38f203c73830eddea16df (diff) | |
Refs #32738 -- Added sanitize_strftime_format() to replace datetime_safe.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/widgets.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 1e67857c31..0a24e924a5 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -10,7 +10,7 @@ from itertools import chain from django.forms.utils import to_current_timezone from django.templatetags.static import static -from django.utils import datetime_safe, formats +from django.utils import formats from django.utils.datastructures import OrderedSet from django.utils.dates import MONTHS from django.utils.formats import get_format @@ -1070,13 +1070,13 @@ class SelectDateWidget(Widget): return None if y is not None and m is not None and d is not None: input_format = get_format('DATE_INPUT_FORMATS')[0] + input_format = formats.sanitize_strftime_format(input_format) try: date_value = datetime.date(int(y), int(m), int(d)) except ValueError: # Return pseudo-ISO dates with zeros for any unselected values, # e.g. '2017-0-23'. return '%s-%s-%s' % (y or 0, m or 0, d or 0) - date_value = datetime_safe.new_date(date_value) return date_value.strftime(input_format) return data.get(name) |
