Need to serialize a chrono Duration

There's a thread on chrono talking about adding support for serialization that is still open after 7 years.

What would be my best workaround for now?

You can use the new_type pattern and wrap chrono's duration and implement serialize on it.

There's also a bunch of representations in serde_with: DurationSeconds in serde_with - Rust

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.