place chrono dep behind feature

This commit is contained in:
Brent Schroeter 2025-09-16 22:46:13 -07:00
parent 9c2943f56c
commit c8337c182a
2 changed files with 11 additions and 1 deletions

View file

@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2024"
[dependencies]
chrono = { version = "0.4.42", features = ["serde"] }
derive_builder = { version = "0.20.2", features = ["clippy"] }
futures = "0.3.31"
percent-encoding = "2.3.2"
@ -12,3 +11,7 @@ reqwest = { version = "0.12.23", features = ["json"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.143"
thiserror = "2.0.16"
chrono = { version = "0.4.42", features = ["serde"], optional = true }
[features]
chrono = ["dep:chrono"]

View file

@ -1,3 +1,4 @@
#[cfg(feature = "chrono")]
use chrono::{DateTime, Utc};
use serde::Deserialize;
@ -10,9 +11,15 @@ where
pub id: String,
/// Timestamp of record creation.
#[cfg(feature = "chrono")]
#[serde(rename = "createdTime")]
pub created_time: DateTime<Utc>,
/// Timestamp of record creation.
#[cfg(not(feature = "chrono"))]
#[serde(rename = "createdTime")]
pub created_time: String,
/// Contents of record data.
pub fields: T,