Print an RSS pubDate as a date, not its first ten characters - #117
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 writespubDatein RFC 822 with the day name first, so every item of a WordPress or Hacker News feed was datedMon, 17 Au.oc open https://wordpress.org/news/feed/ --budget 120:The cause is the
.slice(0, 10)on the date infeedToHTML(src/distill.js). A newfeedDatekeeps that slice for an ISO date and reads an RFC 822 date's day, month, and year as written.Datewould 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.jsgains one test on the existingrss20.xmlfixture: both items print2026-08-17and2026-08-18, the-0700evening post keeps its own day, and an unrecognised date prints whole. Onmainit 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