diff --git a/CHANGES b/CHANGES index a95ac67b1..54c8766fb 100644 --- a/CHANGES +++ b/CHANGES @@ -50,6 +50,7 @@ Bugs fixed * #8671: :confval:`highlight_options` is not working * #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) Testing -------- diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py index e149976ef..05d476ddd 100644 --- a/sphinx/util/i18n.py +++ b/sphinx/util/i18n.py @@ -237,6 +237,8 @@ date_format_mappings = { '%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', # 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 f15f3cb95..d6f631175 100644 --- a/tests/test_util_i18n.py +++ b/tests/test_util_i18n.py @@ -87,6 +87,10 @@ def test_format_date(): assert i18n.format_date(format, date=datet) == 'Feb 7, 2016, 5:11:17 AM' assert i18n.format_date(format, date=date) == 'Feb 7, 2016' + # timezone + format = '%z' + assert i18n.format_date(format, date=datet) == '+0000' + @pytest.mark.xfail(os.name != 'posix', reason="Path separators don't match on windows") def test_get_filename_for_language(app):