Skip to content

Fix the Syndication Feed RFC822 DateTimeParser #99194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dougwaldron
Copy link

RFC822 allows single-digit date values and two-digit year values in the publication date (pubDate). The existing Rfc822DateTimeParser method in System.ServiceModel.Syndication.DateTimeHelper only accepts two-digit dates and (for some formats) four-digit years.

This PR updates the list of date-time formats.

Fixes #99193

RFC822 allows single-digit date values and two-digit year values in the publication date (pubDate). The existing date-time parser only accepted two-digit dates and (for some formats) four-digit years.
"d MMMM yyyy HH:mm:ss zzz",
"ddd, d MMM yyyy HH:mm:ss zzz",
"d MMM yyyy HH:mm:ss zzz",

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@dougwaldron
Copy link
Author

Any chance on getting this merged for .NET 9?

@dougwaldron
Copy link
Author

Any chance of getting this merged for 9.0.2?

This is very simple fix for a bug caused by a small typo. There is almost zero risk to merging this, and it would fix a bug that has existed in my application for a year now.

@stephentoub stephentoub requested a review from Copilot May 28, 2025 18:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the date-time format patterns in the RFC822 parser to correctly handle single-digit day values and two-digit year values as per the RFC822 specification.

  • Updated date format strings to use "d" instead of "dd" for days.
  • Adjusted both the time formats with seconds and without seconds to support the new behavior.
Comments suppressed due to low confidence (2)

src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/DateTimeHelper.cs:95

  • Ensure that unit tests cover the new date-time formats, particularly for cases with single-digit day values and two-digit years.
"ddd, d MMMM yyyy HH:mm:ss zzz",

src/libraries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/DateTimeHelper.cs:105

  • [nitpick] Consider reviewing the ordering of the format patterns to ensure that the most frequently encountered date formats are prioritized for optimal performance.
// The original RFC822 spec listed 2 digit years. RFC1123 updated the format to include 4 digit years and states that you should use 4 digits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Syndication DateTimeHelper class throws an exception on some valid RFC822 dates
2 participants