serde-rs / serde-rs.github.io

https://serde.rs
Creative Commons Attribution Share Alike 4.0 International
22 stars 96 forks source link

Remove usage of deprecated Utc.datetime_from_str from the custom date format example #159

Closed Lachstec closed 10 months ago

Lachstec commented 10 months ago

I came across this example for using custom date formats when using serde and chrono together. The example uses the function Utc.datetime_from_str, which is deprecated since chrono version 0.4.29.

This PR changes the example to use NaiveDateTime::parse_from_str(&self, s: &str, fmt: &str), keeping it simple to understand and without using deprecated code.