summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--sphinx/util/i18n.py2
-rw-r--r--tests/test_util_i18n.py2
3 files changed, 4 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 54c8766fb..53e11f67b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -51,6 +51,7 @@ Bugs fixed
* #8341: C, fix intersphinx lookup types for names in declarations.
* C, C++: in general fix intersphinx and role lookup types.
* #8683: :confval:`html_last_updated_fmt` does not support UTC offset (%z)
+* #8683: :confval:`html_last_updated_fmt` generates wrong time zone for %Z
Testing
--------
diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py
index 05d476ddd..6ea004bb0 100644
--- a/sphinx/util/i18n.py
+++ b/sphinx/util/i18n.py
@@ -236,7 +236,7 @@ date_format_mappings = {
'%X': 'medium', # Locale’s appropriate time representation.
'%y': 'YY', # Year without century as a zero-padded decimal number.
'%Y': 'yyyy', # Year with century as a decimal number.
- '%Z': 'zzzz', # Time zone name (no characters if no time zone exists).
+ '%Z': 'zzz', # Time zone name (no characters if no time zone exists).
'%z': 'ZZZ', # UTC offset in the form ±HHMM[SS[.ffffff]]
# (empty string if the object is naive).
'%%': '%',
diff --git a/tests/test_util_i18n.py b/tests/test_util_i18n.py
index d6f631175..180350e86 100644
--- a/tests/test_util_i18n.py
+++ b/tests/test_util_i18n.py
@@ -88,6 +88,8 @@ def test_format_date():
assert i18n.format_date(format, date=date) == 'Feb 7, 2016'
# timezone
+ format = '%Z'
+ assert i18n.format_date(format, date=datet) == 'UTC'
format = '%z'
assert i18n.format_date(format, date=datet) == '+0000'