Crates.io | time-iso8601 |
lib.rs | time-iso8601 |
version | 0.1.0 |
source | src |
created_at | 2024-04-15 17:14:36.539818 |
updated_at | 2024-04-15 17:14:36.539818 |
description | Serialize and deserialize date-time in ISO-8601 format |
homepage | |
repository | https://github.com/zignis/time-iso8601.git |
max_upload_size | |
id | 1209465 |
size | 4,039 |
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.
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>,
}