A little question: I have a json document storing datetime as "2024-01-23T09:50" . Deserialization with serde to chrono::NaiveDateTime fails because it expects seconds which are missing. Do I really have to implement my custom Deserializer module with #[serde(with = "my_date_format")] or is there a more straightforward way?

Edit: playground example: play.rust-lang.org/?version=st

1
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
teromene

@corpsmoderne Unfortunatelty, no, at least as far as I know.
You don't need a full module for the type though, you can use a simple function

1
10mo
Replies