Skip to content

Commit 0f0683c

Browse files
committed
Remove RSS timezone hack
This removes the temporary hack introduced by commit a30be12 ("Properly handle timezones when building RSS feeds"). As this triggers (I guess due to having items for 2025) Extension error (nxt): Handler <function nxt_write_rss at 0x7febf3143a60> for event 'build-finished' threw an exception (exception: 'title') make: *** [Makefile:24: site] Error 2 Cc: Dan Callahan <[email protected]> Signed-off-by: Andrew Clayton <[email protected]>
1 parent a85eff2 commit 0f0683c

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

source/exts/nxt.py

-25
Original file line numberDiff line numberDiff line change
@@ -838,31 +838,6 @@ def nxt_write_rss(app: Sphinx, error: Exception) -> None:
838838

839839
for e in sorted_entries:
840840
date = datetime.fromisoformat(e["date"])
841-
# FIXME: Remove this after posting an article in 2024.
842-
#
843-
# Our previous code allowed the local system timezone to influence how
844-
# timestamps were serialized into <pubDate> fields.
845-
#
846-
# We need to fix that, but we also need to continue generating the old
847-
# values for old posts. Otherwise we'd confuse RSS feed readers.
848-
#
849-
# We can reliably reproduce the old values by:
850-
#
851-
# 1. Starting with a timezone-naive datetime
852-
# 2. Marking it as being in the Europe/London timezone
853-
# 3. Shifting it into UTC
854-
# 4. Stripping the timezone info, so it is again timezone-naive
855-
#
856-
# The last step produces RFC 2822 timestamps with the "-0000" offset,
857-
# instead of timezone-aware UTC "+0000" offset.
858-
#
859-
# We can remove this hack once we've published a few posts in 2024.
860-
if date.year < 2024:
861-
date = (
862-
date.replace(tzinfo=ZoneInfo("Europe/London"))
863-
.astimezone(timezone.utc)
864-
.replace(tzinfo=None)
865-
)
866841
date = format_datetime(date)
867842
lines.append(
868843
f"""<item><title>{e['title']}</title>

0 commit comments

Comments
 (0)