-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
base: main
Are you sure you want to change the base?
Conversation
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", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...raries/System.ServiceModel.Syndication/src/System/ServiceModel/Syndication/DateTimeHelper.cs
Show resolved
Hide resolved
Any chance on getting this merged for .NET 9? |
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. |
There was a problem hiding this 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.
RFC822 allows single-digit date values and two-digit year values in the publication date (
pubDate
). The existingRfc822DateTimeParser
method inSystem.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