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

Rfc3339 parser allows invalid datetimes to be parsed. #720

Closed
Firstyear opened this issue Dec 21, 2024 · 1 comment
Closed

Rfc3339 parser allows invalid datetimes to be parsed. #720

Firstyear opened this issue Dec 21, 2024 · 1 comment
Labels
A-well-known-format-description Area: well known format descriptions

Comments

@Firstyear
Copy link

Firstyear commented Dec 21, 2024

fn main() {

    let valid = OffsetDateTime::parse("2020-09-25T01:22:02+00:00", &Rfc3339)
        .unwrap();

    let invalid = OffsetDateTime::parse("2020-09-25 01:22:02+00:00", &Rfc3339)
        .unwrap_err();
}

https://datatracker.ietf.org/doc/html/rfc3339#section-5.6

Works in 3.36 but not 3.37. As I'm reading RFC3339, the T is required, and a space isn't valid. date-time = full-date "T" full-time

@jhpratt
Copy link
Member

jhpratt commented Dec 21, 2024

See #700. The spec is not 100% clear, so I decided to go with the more lax parsing (while still only emitting T).

@jhpratt jhpratt closed this as completed Dec 21, 2024
@jhpratt jhpratt added the A-well-known-format-description Area: well known format descriptions label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-well-known-format-description Area: well known format descriptions
Projects
None yet
Development

No branches or pull requests

2 participants