Skip to content

Print an RSS pubDate as a date, not its first ten characters - #117

Merged
only-cli merged 1 commit into
only-cli:mainfrom
kevin9327:fix/rss-pubdate
Sep 28, 2026
Merged

only-cli merged 1 commit into
only-cli:mainfrom
kevin9327:fix/rss-pubdate

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

A feed entry's byline printed the first ten characters of its date. That is the day of an Atom timestamp (2026-08-17T...), but RSS 2.0 writes pubDate in RFC 822 with the day name first, so every item of a WordPress or Hacker News feed was dated Mon, 17 Au.

oc open https://wordpress.org/news/feed/ --budget 120:

main:    ## [1] WordPress 7.1.2 Release
         Tue, 22 Se
branch:  ## [1] WordPress 7.1.2 Release
         2026-09-22

The cause is the .slice(0, 10) on the date in feedToHTML (src/distill.js). A new feedDate keeps that slice for an ISO date and reads an RFC 822 date's day, month, and year as written. Date would parse it too, but it converts to UTC, which moves a post from late evening in a western zone (Sat, 5 Sep 2026 23:30:00 -0700) to the next day, while the Atom slice keeps the day the feed wrote. A date in neither form is printed as the feed wrote it instead of being cut.

Test. tests/distill.test.js gains one test on the existing rss20.xml fixture: both items print 2026-08-17 and 2026-08-18, the -0700 evening post keeps its own day, and an unrecognised date prints whole. On main it fails on the first assertion with ["Hello World","Mon, 17 Au",...]. Full suite on Windows (Node 24): 316 tests, 313 pass, 3 skipped, 0 fail.

Left alone. Two-digit RFC 822 years print as written rather than guessing a century. No CHANGELOG line, to keep this round's PRs from conflicting there; glad to add one.

🤖 Generated with Claude Code

A feed entry's byline took the first ten characters of its date. That is
the day of an Atom timestamp (2026-08-17T...), but RSS 2.0 writes
pubDate in RFC 822, day name first, so every WordPress or Hacker News
item was dated "Mon, 17 Au".

An RFC 822 date is now read for its day, month, and year as written.
Date would parse it too, but it converts to UTC, which moves a post
from late evening in a western zone to the next day, while the Atom
slice keeps the day the feed wrote. A date in neither form is printed
as the feed wrote it instead of being cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@only-cli
only-cli merged commit d83aa1e into only-cli:main Sep 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants