Skip to content

Commit

Permalink
rfc2822 relaxed_weekday
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub committed Jan 3, 2025
1 parent 422cffa commit d8814d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controller/feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ struct SourceItem {
content: String,
}

static P: rfc2822::DateTimeParser = rfc2822::DateTimeParser::new().relaxed_weekday(true);

impl TryFrom<rss::Item> for SourceItem {
type Error = AppError;
fn try_from(rss: rss::Item) -> Result<Self, Self::Error> {
let updated = if let Some(ref pub_date) = rss.pub_date {
if let Ok(ts) = rfc2822::parse(pub_date) {
ts.timestamp().as_second()
if let Ok(ts) = P.parse_timestamp(pub_date) {
ts.as_second()
} else {
warn!("invalid pub_date: {}, rss: {:?}", pub_date, rss.link);
Timestamp::now().as_second()
Expand Down

0 comments on commit d8814d7

Please sign in to comment.