Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
requirements: Remove dateutil.
Anders Kaseorgd4d503f39bb1
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex 9bff09789f1..5a055910864 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,11 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 13.0+**Feature level 503**++* [Message formatting](/api/message-formatting): The global time+ syntax only recognizes ISO 8601 formatted timestamps.+**Feature level 502**No changes; start of Zulip 13.0 development branch.diff --git a/api_docs/message-formatting.md b/api_docs/message-formatting.mdindex 2599bad94f1..1d16a0a588c 100644--- a/api_docs/message-formatting.md+++ b/api_docs/message-formatting.md@@ -19,6 +19,9 @@ for syntax highlighting. This field is used in the## Global times+**Changes**: In Zulip 13.0 (feature level 503), the global time+syntax only recognizes ISO 8601 formatted timestamps.+**Changes**: In Zulip 12.0 (feature level 451), invalid timestamp formatsare now rendered as escaped literal text instead of a `<span>` element with`timestamp-error` class and an error message.diff --git a/puppet/zulip/files/postgresql/pg_backup_and_purge b/puppet/zulip/files/postgresql/pg_backup_and_purgeindex e30315f044d..778a690d3da 100755--- a/puppet/zulip/files/postgresql/pg_backup_and_purge+++ b/puppet/zulip/files/postgresql/pg_backup_and_purge@@ -9,8 +9,6 @@ import sysimport timefrom datetime import datetime, timedelta, timezone-import dateutil.parser-logging.Formatter.converter = time.gmtimelogging.basicConfig(format="%(asctime)s %(levelname)s: %(message)s")logger = logging.getLogger(__name__)@@ -60,7 +58,12 @@ env["WALG_UPLOAD_DISK_CONCURRENCY"] = disk_concurrencysubprocess.check_call(["env-wal-g", "backup-push", pg_data_path], env=env)data = json.loads(subprocess.check_output(["env-wal-g", "backup-list", "--json"]))-backups = {dateutil.parser.parse(backup["time"]): backup["backup_name"] for backup in data}+# Use strptime for Python < 3.11 compatibility; we might not have+# backports-datetime-fromisoformat here+backups = {+ datetime.strptime(backup["time"], "%Y-%m-%dT%H:%M:%S%z"): backup["backup_name"]+ for backup in data+}one_month_ago = datetime.now(tz=timezone.utc) - timedelta(days=30)for date in sorted(backups.keys(), reverse=True):diff --git a/puppet/zulip/manifests/postgresql_backups.pp b/puppet/zulip/manifests/postgresql_backups.ppindex 3e79923095d..e31b2669589 100644--- a/puppet/zulip/manifests/postgresql_backups.pp+++ b/puppet/zulip/manifests/postgresql_backups.pp@@ -20,7 +20,6 @@ class zulip::postgresql_backups {File['/usr/local/bin/env-wal-g'],Package[$zulip::postgresql_common::postgresql,- 'python3-dateutil',],],}diff --git a/puppet/zulip/manifests/postgresql_common.pp b/puppet/zulip/manifests/postgresql_common.ppindex 6795c34183e..18c9168dcf4 100644--- a/puppet/zulip/manifests/postgresql_common.pp+++ b/puppet/zulip/manifests/postgresql_common.pp@@ -13,8 +13,6 @@ class zulip::postgresql_common {'hunspell-en-us',# PostgreSQL Nagios check plugin'check-postgres',- # Python modules used in our monitoring/worker threads- 'python3-dateutil', # TODO: use a virtualenv instead]$postgresql_user_reqs = [Package[$postgresql],@@ -35,9 +33,6 @@ class zulip::postgresql_common {# https://bucardo.org/check_postgres/# 'check-postgres', # TODO]- exec {'pip3_deps':- command => 'python3 -m pip install python-dateutil',- }group { 'ssl-cert':ensure => present,}diff --git a/pyproject.toml b/pyproject.tomlindex d9a66ea7865..35a12b61c56 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -76,9 +76,6 @@ prod = [# Needed for compression support in memcached via python-binary-memcached"django-bmemcached",- # Needed for zerver/tests/test_timestamp.py- "python-dateutil",-# Needed for Redis"redis",@@ -316,7 +313,6 @@ dev = ["types-psycopg2","types-Pygments","types-pyOpenSSL",- "types-python-dateutil","types-PyYAML","types-redis","types-regex",diff --git a/starlight_help/src/content/include/_GlobalTimesExamples.mdx b/starlight_help/src/content/include/_GlobalTimesExamples.mdxindex d2619324aaf..1f86c940509 100644--- a/starlight_help/src/content/include/_GlobalTimesExamples.mdx+++ b/starlight_help/src/content/include/_GlobalTimesExamples.mdx@@ -8,10 +8,8 @@ A date picker will appear once you type `<time`.Our next meeting is scheduled for <time:2024-08-06T17:00:00+01:00>.```-<ZulipTip>- You can also use other formats such as UNIX timestamps or human readable- dates, for example, `<time:August 06 2024, 5:00 PM BST>`.-</ZulipTip>+The selected time is inserted into your Markdown message along with+your time zone (in ISO 8601 format).### What it looks likediff --git a/uv.lock b/uv.lockindex fa6e3f5033d..1481f902900 100644--- a/uv.lock+++ b/uv.lock@@ -5568,15 +5568,6 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/98/05/c868a850b6fbb79c26f5f299b768ee0adc1f9816d3461dcf4287916f655b/types_pyOpenSSL-24.1.0.20240722-py3-none-any.whl", hash = "sha256:6a7a5d2ec042537934cfb4c9d4deb0e16c4c6250b09358df1f083682fe6fda54", size = 7499, upload-time = "2024-07-22T02:32:21.232Z" },]-[[package]]-name = "types-python-dateutil"-version = "2.9.0.20260408"-source = { registry = "https://pypi.org/simple" }-sdist = { url = "https://files.pythonhosted.org/packages/88/f3/2427775f80cd5e19a0a71ba8e5ab7645a01a852f43a5fd0ffc24f66338e0/types_python_dateutil-2.9.0.20260408.tar.gz", hash = "sha256:8b056ec01568674235f64ecbcef928972a5fac412f5aab09c516dfa2acfbb582", size = 16981, upload-time = "2026-04-08T04:28:10.995Z" }-wheels = [- { url = "https://files.pythonhosted.org/packages/fd/c6/eeba37bfee282a6a97f889faef9352d6172c6a5088eb9a4daf570d9d748d/types_python_dateutil-2.9.0.20260408-py3-none-any.whl", hash = "sha256:473139d514a71c9d1fbd8bb328974bedcb1cc3dba57aad04ffa4157f483c216f", size = 18437, upload-time = "2026-04-08T04:28:10.095Z" },-]-[[package]]name = "types-pyyaml"version = "6.0.12.20260408"@@ -6353,7 +6344,6 @@ dev = [{ name = "pyoembed" },{ name = "python-binary-memcached" },{ name = "python-bsonstream" },- { name = "python-dateutil" },{ name = "python-debian" },{ name = "python-digitalocean" },{ name = "python-ldap" },@@ -6398,7 +6388,6 @@ dev = [{ name = "types-psycopg2" },{ name = "types-pygments" },{ name = "types-pyopenssl" },- { name = "types-python-dateutil" },{ name = "types-pyyaml" },{ name = "types-redis" },{ name = "types-regex" },@@ -6484,7 +6473,6 @@ prod = [{ name = "pyoembed" },{ name = "python-binary-memcached" },{ name = "python-bsonstream" },- { name = "python-dateutil" },{ name = "python-ldap" },{ name = "python-magic" },{ name = "python3-saml" },@@ -6599,7 +6587,6 @@ dev = [{ name = "pyoembed" },{ name = "python-binary-memcached" },{ name = "python-bsonstream", specifier = ">=0.1.4" },- { name = "python-dateutil" },{ name = "python-debian" },{ name = "python-digitalocean" },{ name = "python-ldap" },@@ -6646,7 +6633,6 @@ dev = [{ name = "types-psycopg2" },{ name = "types-pygments" },{ name = "types-pyopenssl" },- { name = "types-python-dateutil" },{ name = "types-pyyaml" },{ name = "types-redis" },{ name = "types-regex" },@@ -6732,7 +6718,6 @@ prod = [{ name = "pyoembed" },{ name = "python-binary-memcached" },{ name = "python-bsonstream", specifier = ">=0.1.4" },- { name = "python-dateutil" },{ name = "python-ldap" },{ name = "python-magic" },{ name = "python3-saml" },diff --git a/version.py b/version.pyindex 2eaaf69c6a8..833fc93ca7f 100644--- a/version.py+++ b/version.py@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"# https://zulip.readthedocs.io/en/latest/documentation/api.html#step-by-step-guide# Also available at docs/documentation/api.md.-API_FEATURE_LEVEL = 502+API_FEATURE_LEVEL = 503# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bump@@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 502# historical commits sharing the same major version, in which case a# minor version bump suffices.-PROVISION_VERSION = (378, 0) # bumped 2026-05-07 to remove litellm+PROVISION_VERSION = (379, 0) # bumped 2026-05-07 to remove dateutildiff --git a/web/src/markdown.ts b/web/src/markdown.tsindex f893ec2e269..9e1411c2985 100644--- a/web/src/markdown.ts+++ b/web/src/markdown.ts@@ -572,16 +572,7 @@ function handleLinkifier({}function handleTimestamp(time_string: string): string {- let timeobject;- const time = Number(time_string);-- if (Number.isNaN(time)) {- timeobject = new Date(time_string); // not a Unix timestamp- } else {- // JavaScript dates are in milliseconds, Unix timestamps are in seconds- timeobject = new Date(time * 1000);- }-+ const timeobject = new Date(time_string);const escaped_time = _.escape(time_string);if (!isValid(timeobject) || getUnixTime(timeobject) < 0) {// Unsupported time format: rerender accordingly.diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.pyindex 80379e5b6d8..6cdc1a89e37 100644--- a/zerver/lib/markdown/__init__.py+++ b/zerver/lib/markdown/__init__.py@@ -15,8 +15,6 @@ from urllib.parse import parse_qs, parse_qsl, urlencode, urljoin, urlsplit, urlufrom xml.etree.ElementTree import Element, SubElementimport ahocorasick-import dateutil.parser-import dateutil.tzimport lxml.etreeimport markdownimport markdown.blockprocessors@@ -62,7 +60,6 @@ from zerver.lib.thumbnail import (rewrite_thumbnailed_images,)from zerver.lib.timeout import unsafe_timeout-from zerver.lib.timezone import common_timezonesfrom zerver.lib.topic_link_util import TOPIC_LINK_SYNTAX_FOR_DISPLAYfrom zerver.lib.types import LinkifierDictfrom zerver.lib.url_encoding import encode_channel, encode_hash_component@@ -1240,14 +1237,8 @@ class Timestamp(markdown.inlinepatterns.Pattern):def handleMatch(self, match: Match[str]) -> Element | str:time_input_string = match.group("time")try:- timestamp = dateutil.parser.parse(time_input_string, tzinfos=common_timezones)- except (ValueError, OverflowError):- try:- timestamp = datetime.fromtimestamp(float(time_input_string), tz=timezone.utc)- except ValueError:- timestamp = None-- if not timestamp:+ timestamp = datetime.fromisoformat(time_input_string)+ except ValueError:return f"<time:{time_input_string}>"# Use HTML5 <time> element for valid timestamps.diff --git a/zerver/lib/timezone.py b/zerver/lib/timezone.pyindex 0c9c41eb9c4..348e3c6b78d 100644--- a/zerver/lib/timezone.py+++ b/zerver/lib/timezone.py@@ -17,60 +17,3 @@ def get_canonical_timezone_map() -> dict[str, str]:def canonicalize_timezone(key: str) -> str:return get_canonical_timezone_map().get(key, key)---# Note: some of these abbreviations are fundamentally ambiguous (see-# zerver/tests/test_timezone.py), so you should never rely on them as-# anything more than a heuristic.-common_timezones = {- "SST": -39600,- "HST": -36000,- "AKST": -32400,- "HDT": -32400,- "AKDT": -28800,- "PST": -28800,- "MST": -25200,- "PDT": -25200,- "CST": -21600,- "MDT": -21600,- "CDT": -18000,- "EST": -18000,- "AST": -14400,- "EDT": -14400,- "NST": -12600,- "ADT": -10800,- "NDT": -9000,- "GMT": 0,- "UTC": 0,- "WET": 0,- "BST": +3600,- "CET": +3600,- "MET": +3600,- "WAT": +3600,- "WEST": +3600,- "CAT": +7200,- "CEST": +7200,- "EET": +7200,- "MEST": +7200,- "SAST": +7200,- "EAT": +10800,- "EEST": +10800,- "IDT": +10800,- "MSK": +10800,- "PKT": +18000,- "IST": +19800,- "WIB": +25200,- "AWST": +28800,- "HKT": +28800,- "WITA": +28800,- "JST": +32400,- "KST": +32400,- "WIT": +32400,- "ACST": +34200,- "AEST": +36000,- "ChST": +36000,- "ACDT": +37800,- "AEDT": +39600,- "NZST": +43200,- "NZDT": +46800,-}diff --git a/zerver/tests/fixtures/markdown_test_cases.json b/zerver/tests/fixtures/markdown_test_cases.jsonindex b4bcce79972..0dc8976fc49 100644--- a/zerver/tests/fixtures/markdown_test_cases.json+++ b/zerver/tests/fixtures/markdown_test_cases.json@@ -811,17 +811,16 @@"text_content": "gonna take a break for a bit--all yours if you want to play around too. what I did:\n\ninstall cmake\ngit clone zulip desktop\nrun cmake-gui .. in c:\\zulip\\zulip-desktop\\msvcbuild\nhit configure\/generate until it generated the msvc project (had to make a fix to some cmake files)\nopened vs2013 \ntried to build\n"},{- "name": "timestamp_backend_markdown_only",- "input": "<time:Jun 5th 2017, 10:30PM>",- "expected_output": "<p><time datetime=\"2017-06-05T22:30:00Z\">Jun 5th 2017, 10:30PM</time></p>",- "marked_expected_output": "<p><span>Jun 5th 2017, 10:30PM</span></p>",- "text_content": "Jun 5th 2017, 10:30PM"+ "name": "timestamp_no_timezone",+ "input": "<time:2017-06-05T22:30>",+ "expected_output": "<p><time datetime=\"2017-06-05T22:30:00Z\">2017-06-05T22:30</time></p>",+ "text_content": "2017-06-05T22:30"},{- "name": "timestamp_backend_markdown_and_marked",- "input": "<time:31 Dec 2017>",- "expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">31 Dec 2017</time></p>",- "text_content": "31 Dec 2017"+ "name": "timestamp_date_only",+ "input": "<time:2017-12-31>",+ "expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">2017-12-31</time></p>",+ "text_content": "2017-12-31"},{"name": "timestamp_invalid_input",@@ -832,10 +831,9 @@},{"name": "timestamp_timezone",- "input": "<time:31 Dec 2017 5:30 am IST>",- "expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">31 Dec 2017 5:30 am IST</time></p>",- "marked_expected_output": "<p><span>31 Dec 2017 5:30 am IST</span></p>",- "text_content": "31 Dec 2017 5:30 am IST"+ "input": "<time:2017-12-31T05:30+05:30>",+ "expected_output": "<p><time datetime=\"2017-12-31T00:00:00Z\">2017-12-31T05:30+05:30</time></p>",+ "text_content": "2017-12-31T05:30+05:30"},{"name": "timestamp_incorrect",@@ -858,19 +856,6 @@"marked_expected_output": "<p><span>0001-01-01T01:00:00+02:00</span></p>","text_content": "<time:0001-01-01T01:00:00+02:00>"},- {- "name": "timestamp_unix",- "input": "Let's meet at <time:1496701800>.",- "expected_output": "<p>Let's meet at <time datetime=\"2017-06-05T22:30:00Z\">1496701800</time>.</p>",- "text_content": "Let's meet at 1496701800."- },- {- "name": "timestamp_unix_overflow",- "input": "Let's meet at <time:1234567890123>.",- "expected_output": "<p>Let's meet at <time:1234567890123>.</p>",- "marked_expected_output": "<p>Let's meet at <time datetime=\"+041091-11-25T05:02:03Z\">1234567890123</time>.</p>",- "text_content": "Let's meet at <time:1234567890123>."- },{"name": "tex_inline","input": "$$1 \\oplus 0 = 1$$",diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex 0409247569a..8b556b24899 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -8,7 +8,7 @@ import copyimport timefrom collections.abc import Callable, Iteratorfrom contextlib import contextmanager-from datetime import timedelta+from datetime import datetime, timedeltafrom enum import Enumfrom io import StringIOfrom typing import Any@@ -16,7 +16,6 @@ from unittest import mockimport orjsonimport time_machine-from dateutil.parser import parse as dateparserfrom django.utils.timezone import now as timezone_nowfrom typing_extensions import override@@ -269,7 +268,7 @@ from zerver.lib.test_helpers import (reset_email_visibility_to_everyone_in_zulip_realm,stdout_suppressed,)-from zerver.lib.timestamp import convert_to_UTC, datetime_to_timestamp+from zerver.lib.timestamp import datetime_to_timestampfrom zerver.lib.topic import TOPIC_NAMEfrom zerver.lib.types import (Invitee,@@ -5617,7 +5616,7 @@ class ScheduledMessagesEventsTest(BaseAction):[self.get_stream_id("Verona")],"Test topic","Stream message",- convert_to_UTC(dateparser("2023-04-19 18:24:56")),+ datetime.fromisoformat("2023-04-19 18:24:56+00:00"),self.user_profile.realm,)check_scheduled_message_add("events[0]", events[0])@@ -5631,7 +5630,7 @@ class ScheduledMessagesEventsTest(BaseAction):[self.get_stream_id("Verona")],"Test topic","Stream message 1",- convert_to_UTC(dateparser("2023-04-19 17:24:56")),+ datetime.fromisoformat("2023-04-19 17:24:56+00:00"),self.user_profile.realm,)@@ -5644,7 +5643,7 @@ class ScheduledMessagesEventsTest(BaseAction):[self.get_stream_id("Verona")],"Test topic","Stream message 2",- convert_to_UTC(dateparser("2023-04-19 18:24:56")),+ datetime.fromisoformat("2023-04-19 18:24:56+00:00"),self.user_profile.realm,)check_scheduled_message_add("events[0]", events[0])@@ -5659,7 +5658,7 @@ class ScheduledMessagesEventsTest(BaseAction):[self.example_user("hamlet").id],None,"Direct message",- convert_to_UTC(dateparser("2023-04-19 18:24:56")),+ datetime.fromisoformat("2023-04-19 18:24:56+00:00"),self.user_profile.realm,)check_scheduled_message_add("events[0]", events[0])@@ -5672,7 +5671,7 @@ class ScheduledMessagesEventsTest(BaseAction):[self.get_stream_id("Verona")],"Test topic","Stream message",- convert_to_UTC(dateparser("2023-04-19 18:24:56")),+ datetime.fromisoformat("2023-04-19 18:24:56+00:00"),self.user_profile.realm,)with self.verify_action() as events:@@ -5684,7 +5683,7 @@ class ScheduledMessagesEventsTest(BaseAction):None,"Edited test topic","Edited stream message",- convert_to_UTC(dateparser("2023-04-20 18:24:56")),+ datetime.fromisoformat("2023-04-20 18:24:56+00:00"),self.user_profile.realm,)check_scheduled_message_update("events[0]", events[0])@@ -5697,7 +5696,7 @@ class ScheduledMessagesEventsTest(BaseAction):[self.get_stream_id("Verona")],"Test topic","Stream message",- convert_to_UTC(dateparser("2023-04-19 18:24:56")),+ datetime.fromisoformat("2023-04-19T18:24:56+00:00"),self.user_profile.realm,)with self.verify_action() as events:@@ -5711,7 +5710,7 @@ class RemindersEventsTest(BaseAction):self.user_profile,get_client("website"),message_id,- convert_to_UTC(dateparser("2023-04-19 18:24:56")),+ datetime.fromisoformat("2023-04-19 18:24:56+00:00"),note="",)diff --git a/zerver/tests/test_timestamp.py b/zerver/tests/test_timestamp.pyindex 82fceee8574..fa7ae977896 100644--- a/zerver/tests/test_timestamp.py+++ b/zerver/tests/test_timestamp.py@@ -1,7 +1,6 @@from datetime import datetime, timedelta, timezonefrom zoneinfo import ZoneInfo-from dateutil import parserfrom django.utils.translation import override as override_languagefrom zerver.lib.test_classes import ZulipTestCase@@ -23,30 +22,29 @@ class TestTimestamp(ZulipTestCase):def test_datetime_and_timestamp_conversions(self) -> None:timestamp = 1483228800for dt in [- parser.parse("2017-01-01 00:00:00.123 UTC"),- parser.parse("2017-01-01 00:00:00.123").replace(tzinfo=timezone.utc),+ datetime.fromisoformat("2017-01-01 00:00:00.123+00:00"),]:self.assertEqual(timestamp_to_datetime(timestamp), dt - timedelta(microseconds=123000))self.assertEqual(datetime_to_timestamp(dt), timestamp)for dt in [- parser.parse("2017-01-01 00:00:00.123+01:00"),- parser.parse("2017-01-01 00:00:00.123"),+ datetime.fromisoformat("2017-01-01 00:00:00.123+01:00"),+ datetime.fromisoformat("2017-01-01 00:00:00.123"),]:with self.assertRaises(TimeZoneNotUTCError):datetime_to_timestamp(dt)def test_convert_to_UTC(self) -> None:- utc_datetime = parser.parse("2017-01-01 00:00:00.123 UTC")+ utc_datetime = datetime.fromisoformat("2017-01-01 00:00:00.123+00:00")for dt in [- parser.parse("2017-01-01 00:00:00.123").replace(tzinfo=timezone.utc),- parser.parse("2017-01-01 00:00:00.123"),- parser.parse("2017-01-01 05:00:00.123+05"),+ datetime.fromisoformat("2017-01-01 00:00:00.123+00:00"),+ datetime.fromisoformat("2017-01-01 00:00:00.123"),+ datetime.fromisoformat("2017-01-01T05:00:00.123+05:00"),]:self.assertEqual(convert_to_UTC(dt), utc_datetime)def test_enforce_UTC(self) -> None:- non_utc_datetime = parser.parse("2017-01-01 00:00:00.123")+ non_utc_datetime = datetime.fromisoformat("2017-01-01 00:00:00.123")for function in [floor_to_hour, floor_to_day, ceiling_to_hour, ceiling_to_hour]:with self.assertRaises(TimeZoneNotUTCError):function(non_utc_datetime)diff --git a/zerver/tests/test_timezone.py b/zerver/tests/test_timezone.pyindex 3a5bbb32f7a..772e4fcdd44 100644--- a/zerver/tests/test_timezone.py+++ b/zerver/tests/test_timezone.py@@ -1,10 +1,5 @@-import zoneinfo-from datetime import datetime, timezone--from django.utils.timezone import now as timezone_now-from zerver.lib.test_classes import ZulipTestCase-from zerver.lib.timezone import canonicalize_timezone, common_timezones+from zerver.lib.timezone import canonicalize_timezoneclass TimeZoneTest(ZulipTestCase):@@ -12,42 +7,3 @@ class TimeZoneTest(ZulipTestCase):self.assertEqual(canonicalize_timezone("America/Los_Angeles"), "America/Los_Angeles")self.assertEqual(canonicalize_timezone("US/Pacific"), "America/Los_Angeles")self.assertEqual(canonicalize_timezone("Gondor/Minas_Tirith"), "Gondor/Minas_Tirith")-- def test_common_timezones(self) -> None:- ambiguous_abbrevs = [- ("CDT", -18000.0), # Central Daylight Time- ("CDT", -14400.0), # Cuba Daylight Time- ("CST", -21600.0), # Central Standard Time- ("CST", +28800.0), # China Standard Time- ("CST", -18000.0), # Cuba Standard Time- ("PST", -28800.0), # Pacific Standard Time- ("PST", +28800.0), # Philippine Standard Time- ("IST", +19800.0), # India Standard Time- ("IST", +7200.0), # Israel Standard Time- ("IST", +3600.0), # Ireland Standard Time- ]- missing = set(dict(reversed(ambiguous_abbrevs)).items()) - set(common_timezones.items())- assert not missing, missing-- now = timezone_now()- dates = [- datetime(now.year, 6, 21, tzinfo=timezone.utc),- datetime(now.year, 12, 21, tzinfo=timezone.utc),- ]- extra = {*common_timezones.items(), *ambiguous_abbrevs}- extra -= {("MET", +3600), ("MEST", +7200)} # Removed in tzdata 2024b- for name in zoneinfo.available_timezones():- tz = zoneinfo.ZoneInfo(name)- for date in dates:- abbrev = tz.tzname(date)- assert abbrev is not None- if abbrev.startswith(("-", "+")):- continue- delta = tz.utcoffset(date)- assert delta is not None- offset = delta.total_seconds()- assert (- common_timezones[abbrev] == offset or (abbrev, offset) in ambiguous_abbrevs- ), (name, abbrev, offset)- extra.discard((abbrev, offset))- assert not extra, extradiff --git a/zilencer/management/commands/rundjangoserver.py b/zilencer/management/commands/rundjangoserver.pyindex f3b2da8ffc5..2d7df5d42fd 100644--- a/zilencer/management/commands/rundjangoserver.py+++ b/zilencer/management/commands/rundjangoserver.py@@ -2,14 +2,13 @@ from collections.abc import Callablefrom datetime import datetimefrom functools import wraps-from dateutil.tz import tzlocalfrom django.core.management.commands.runserver import Command as DjangoCommandfrom typing_extensions import overridedef output_styler(style_func: Callable[[str], str]) -> Callable[[str], str]:# Might fail to suppress the date line around midnight, but, whatever.- date_prefix = datetime.now(tzlocal()).strftime("%B %d, %Y - ")+ date_prefix = datetime.now().astimezone().strftime("%B %d, %Y - ")@wraps(style_func)def _wrapped_style_func(message: str) -> str: