Skip to content

Fix timezone and sub-second in RFC822 parser.#82

Merged
dinosaure merged 1 commit intoCumulus:masterfrom
paurkedal:fix-rfc822-parser
Feb 26, 2026
Merged

Fix timezone and sub-second in RFC822 parser.#82
dinosaure merged 1 commit intoCumulus:masterfrom
paurkedal:fix-rfc822-parser

Conversation

@paurkedal
Copy link
Copy Markdown
Contributor

I noticed times from parsed feed comes out in local time without time zone. Looking at the code, this seems unintended. The issue is that passing the time-zone Ptime.to_date_time with both adjust the date and time tuples, as well as passing the time zone offset in the time tuple component, which Ptime.of_date_time uses the latter to adjust the time back to it's original value.

An easy adjustment would substitute 0 for the TZ in between the calls, but I here propose dropping the round-trip all together, as it's easy to substitute the correction into the time span used for composing the time. This also allows us to keep the sub-second precision.

Before:

utop # Syndic__Syndic_date.of_rfc822 "Sun, 19 May 2002 15:21:36 EST Sat";;
- : Ptime.t = 2002-05-19 15:21:36 +00:00

After:

utop # Syndic__Syndic_date.of_rfc822 "Sun, 19 May 2002 15:21:36 EST Sat";;
- : Ptime.t = 2002-05-19 20:21:36 +00:00

@dinosaure dinosaure self-assigned this Jun 19, 2025
@dinosaure
Copy link
Copy Markdown
Member

Thanks, and sorry for the delay, I will cut a release as soon as possible.

@dinosaure dinosaure merged commit c61e206 into Cumulus:master Feb 26, 2026
dinosaure added a commit to dinosaure/opam-repository that referenced this pull request Feb 27, 2026
CHANGES:

- Fix timezone for RFC822 data (@paurkedal, Cumulus/Syndic#82)
- Contributing about documentation (@Olexandr88, Cumulus/Syndic#89)
- Allow selectively relaxed parsing rules (@kit-ty-kate, Cumulus/Syndic#90)
@paurkedal paurkedal deleted the fix-rfc822-parser branch March 9, 2026 14:47
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