Skip to content

zignis/time-iso8601

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

time-iso8601

Serializes and deserializes OffsetDateTime from the time crate in 4-digit year format with 2-digit time precision to work with the majority of web frameworks.

Examples

use serde::{Serialize, Deserialize};
use time::OffsetDateTime;

#[derive(Debug, Serialize, Deserialize)]
struct User {
    #[serde(with = "time-iso8601")]
    datetime_field: OffsetDateTime,
    #[serde(with = "time-iso8601::option")]
    optional_field: Option<OffsetDateTime>,
}

About

Serialize and deserialize date-time in ISO-8601 format

Topics

Resources

License

Stars

Watchers

Forks

Languages