diff --git a/src/mkdocs_git_revision_date_localized_plugin/dates.py b/src/mkdocs_git_revision_date_localized_plugin/dates.py index c66e4a5..f27e6fe 100644 --- a/src/mkdocs_git_revision_date_localized_plugin/dates.py +++ b/src/mkdocs_git_revision_date_localized_plugin/dates.py @@ -33,6 +33,12 @@ def get_date_formats( loc_revision_date.strftime("%H:%M:%S"), ] ), + "datetime-timezone": " ".join( + [ + format_date(loc_revision_date, format="long", locale=locale), + loc_revision_date.strftime("%H:%M:%S %Z"), + ] + ), "iso_date": loc_revision_date.strftime("%Y-%m-%d"), "iso_datetime": loc_revision_date.strftime("%Y-%m-%d %H:%M:%S"), "timeago": '' % (loc_revision_date.isoformat(), locale), diff --git a/src/mkdocs_git_revision_date_localized_plugin/util.py b/src/mkdocs_git_revision_date_localized_plugin/util.py index 5c43cca..f0069f0 100644 --- a/src/mkdocs_git_revision_date_localized_plugin/util.py +++ b/src/mkdocs_git_revision_date_localized_plugin/util.py @@ -230,7 +230,7 @@ def add_spans(date_formats: Dict[str, str]) -> Dict[str, str]: """ Wraps the date string in elements with CSS identifiers. """ - datetime_string = date_formats["datetime"] + datetime_string = date_formats["datetime-timezone"] for date_type, date_string in date_formats.items(): date_formats[date_type] = ( '%s' diff --git a/tests/test_dates.py b/tests/test_dates.py index 8ef4a33..e3b234a 100644 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -10,6 +10,7 @@ def test_get_dates(): expected_output = { "date": "January 1, 1970", "datetime": "January 1, 1970 00:00:00", + "datetime-timezone": "January 1, 1970 00:00:00 UTC", "iso_date": "1970-01-01", "iso_datetime": "1970-01-01 00:00:00", "timeago": '', @@ -26,6 +27,7 @@ def test_get_dates(): expected_output = { "date": "1 janvier 1970", "datetime": "1 janvier 1970 00:00:00", + "datetime-timezone": "1 janvier 1970 00:00:00 UTC", "iso_date": "1970-01-01", "iso_datetime": "1970-01-01 00:00:00", "timeago": '', @@ -37,6 +39,7 @@ def test_get_dates(): expected_output = { "date": "1 de janeiro de 1970", "datetime": "1 de janeiro de 1970 00:00:00", + "datetime-timezone": "1 de janeiro de 1970 00:00:00 UTC", "iso_date": "1970-01-01", "iso_datetime": "1970-01-01 00:00:00", "timeago": '', @@ -52,6 +55,7 @@ def test_get_dates(): expected_output = { "date": "January 1, 1970", "datetime": "January 1, 1970 00:00:00", + "datetime-timezone": "January 1, 1970 00:00:00 UTC", "iso_date": "1970-01-01", "iso_datetime": "1970-01-01 00:00:00", "timeago": '', @@ -63,6 +67,7 @@ def test_get_dates(): expected_output = { "date": "January 1, 1970", "datetime": "January 1, 1970 02:00:00", + "datetime-timezone": "January 1, 1970 02:00:00 CET", "iso_date": "1970-01-01", "iso_datetime": "1970-01-01 02:00:00", "timeago": '', @@ -84,6 +89,7 @@ def test_get_dates(): expected_output = { "date": "October 15, 2023", "datetime": "October 15, 2023 13:32:04", + "datetime-timezone": "October 15, 2023 13:32:04 CEST", "iso_date": "2023-10-15", "iso_datetime": "2023-10-15 13:32:04", "timeago": '', @@ -94,6 +100,7 @@ def test_get_dates(): assert get_date_formats(1582397529) == { "date": "February 22, 2020", "datetime": "February 22, 2020 18:52:09", + "datetime-timezone": "February 22, 2020 18:52:09 UTC", "iso_date": "2020-02-22", "iso_datetime": "2020-02-22 18:52:09", "timeago": '',