Skip to content
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

Datetime Parse Error when converting rfc2822 date to chrono Datetime #1580

Closed
SamTV12345 opened this issue May 12, 2024 · 2 comments
Closed

Comments

@SamTV12345
Copy link

Hi Chrono maintainers,

I am maintaining a podcast management tool written in Rust. When saving podcast episodes I use the date of recording of mentioned episode. Unfortunately some podcast episodes return a parse error impossible. Below code snippets errors withb a ParseError. Do you have an idea why? I checked multiple validators and they all said this is encoded in rfc2822 format.

    let date_str = "Fri, 03 Jul 2014 08:00:00 +0100";
    let date = DateTime::parse_from_rfc2822(date_str).unwrap().with_timezone(&Utc);
    println!("{}", date);
@pitdicker
Copy link
Collaborator

The format is valid according to RFC 2822, but the day of the week does not match the date. 2014-07-03 was a Thursday.

@SamTV12345
Copy link
Author

Thanks for the response. This explains the error pretty much. I'll split the string after the day so that I shouldn't get an error. Hopefully the author didn't invent any invalid dates :)

@djc djc closed this as not planned Won't fix, can't repro, duplicate, stale May 12, 2024
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

No branches or pull requests

3 participants