From 8929afb8ec4bc2bfb95b66c05fc3ab39e3748d91 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Thu, 21 Nov 2019 20:34:58 +0100 Subject: [PATCH] Fixed #9762 -- Made DateFormat.r() locale-independent. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Antonio Melé for the original report all those years ago and to all the contributors who helped along the way. --- django/utils/dateformat.py | 11 +++++++++-- tests/utils_tests/test_dateformat.py | 11 ++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py index 5bde2680b8..7a8c83af09 100644 --- a/django/utils/dateformat.py +++ b/django/utils/dateformat.py @@ -13,12 +13,15 @@ Usage: import calendar import datetime import time +from email.utils import format_datetime as format_datetime_rfc5322 from django.utils.dates import ( MONTHS, MONTHS_3, MONTHS_ALT, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR, ) from django.utils.regex_helper import _lazy_re_compile -from django.utils.timezone import get_default_timezone, is_aware, is_naive +from django.utils.timezone import ( + get_default_timezone, is_aware, is_naive, make_aware, +) from django.utils.translation import gettext as _ re_formatchars = _lazy_re_compile(r'(?