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

Cannot deserialize TOML Local Date into chrono::NaiveDate. #547

Closed
Bodleum opened this issue Apr 26, 2023 · 1 comment
Closed

Cannot deserialize TOML Local Date into chrono::NaiveDate. #547

Bodleum opened this issue Apr 26, 2023 · 1 comment

Comments

@Bodleum
Copy link

Bodleum commented Apr 26, 2023

The crate errors when trying to deserialize a TOML Local Date into a chrono::NaiveDate.

Minimum working example:

use serde::Deserialize;

#[derive(Deserialize)]
struct Date {
    date: chrono::NaiveDate,
}

fn main(){
    let toml = r#"date = 2000-01-01"#;
    let date: Result<Date, _> = toml::from_str(toml);
    match date {
        Ok(ok) => println!("{}", ok.date),
        Err(err) => println!("{err}"),
    }
}

Playground

Produces error:

TOML parse error at line 1, column 8
  |
1 | date = 2000-01-01
  |        ^^^^^^^^^^
invalid type: map, expected a formatted date string
@epage
Copy link
Member

epage commented Apr 26, 2023

Closing in favor of #390

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2023
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

2 participants