diff --git a/ietf/doc/expire.py b/ietf/doc/expire.py index f6779e0471..bfb3ecc6f5 100644 --- a/ietf/doc/expire.py +++ b/ietf/doc/expire.py @@ -8,6 +8,7 @@ import datetime, os, shutil, glob, re from pathlib import Path +from zoneinfo import ZoneInfo from typing import List, Optional # pyflakes:ignore @@ -86,10 +87,15 @@ def send_expire_warning_for_draft(doc): (doc.get_state_slug("draft") != "active")): return # don't warn about dead or inactive documents - expiration = doc.expires.astimezone(DEADLINE_TZINFO).date() + expiration = doc.expires.astimezone( + DEADLINE_TZINFO + ).replace( + hour=0, minute=0, second=0, microsecond=0 + ).astimezone( + ZoneInfo('UTC') + ) now_plus_12hours = timezone.now() + datetime.timedelta(hours=12) - soon = now_plus_12hours.date() - if expiration <= soon: + if expiration <= now_plus_12hours: # The document will expire very soon, which will send email to the # same people, so do not send the warning at this point in time return diff --git a/ietf/doc/tests_draft.py b/ietf/doc/tests_draft.py index bf88b0f28d..8dd92d27a8 100644 --- a/ietf/doc/tests_draft.py +++ b/ietf/doc/tests_draft.py @@ -711,6 +711,7 @@ def test_warn_expirable_drafts(self): self.assertTrue('draft-ietf-mars-test@' in outbox[-1]['To']) # Gets the authors self.assertTrue('mars-chairs@ietf.org' in outbox[-1]['Cc']) self.assertTrue('aread@' in outbox[-1]['Cc']) + self.assertIn('UTC' , get_payload_text(outbox[-1])) # hack into expirable state to expire in 10 hours draft.expires = timezone.now() + datetime.timedelta(hours=10) diff --git a/ietf/templates/doc/draft/expire_warning_email.txt b/ietf/templates/doc/draft/expire_warning_email.txt index d43fadacec..4b739b1547 100644 --- a/ietf/templates/doc/draft/expire_warning_email.txt +++ b/ietf/templates/doc/draft/expire_warning_email.txt @@ -1,7 +1,7 @@ -{% load ietf_filters %}{% autoescape off %}The following Internet-Draft will expire soon: +{% load ietf_filters tz %}{% autoescape off %}The following Internet-Draft will expire soon: Name: {{ doc.name|clean_whitespace }} Title: {{ doc.title}} State: {{ state }} -Expires: {{ expiration }} (in {{ expiration|timeuntil }}) +Expires: {{ expiration|utc }} (in {{ expiration|timeuntil }}) {% endautoescape %}