Skip to content

fix(atom): emit a full date-time for entry updated when updated_at is a date - #226

Merged
eelcoj merged 1 commit into
Rails-Designer:mainfrom
pcbeingused333:fix/atom-updated-datetime
Nov 23, 2026
Merged

eelcoj merged 1 commit into
Rails-Designer:mainfrom
pcbeingused333:fix/atom-updated-datetime

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Related to #220 and #216 (date formatting in feeds).

Frontmatter is loaded with YAML.safe_load(..., permitted_classes: [Date, ...]), so updated_at: 2023-05-15 becomes a Date. In atom.erb the entry's <updated> is (metadata.updated_at || published_at)&.iso8601, and Date#iso8601 returns 2023-05-15. Atom (RFC 4287) requires <updated> to be an RFC 3339 date-time, so feed validators reject the date-only value.

The fix goes through in_time_zone first (Date → midnight in Time.zone; Time/TimeWithZone unchanged), so the output becomes e.g. 2023-05-15T00:00:00+00:00. String values are a separate case, handled in #225.

Tests: new case in atom_test.rb asserting the <updated> of the "Sample Post" entry (fixture has updated_at: 2023-05-15) is a full date-time.

This change was prepared with the help of an AI coding assistant (Claude); the author is responsible for it.

… a date

Frontmatter updated_at can be a Date (YAML 2023-05-15), and Date#iso8601 yields a date-only string, which is not a valid Atom date construct (RFC 4287 requires RFC 3339 date-time). Convert through in_time_zone first.
@eelcoj
eelcoj merged commit 554e33d into Rails-Designer:main Nov 23, 2026
3 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