kumo_chrono_helper/
lib.rspub use chrono;
pub use chrono::{DateTime, TimeZone, Utc};
#[allow(deprecated)]
pub const MINUTE: chrono::Duration = chrono::Duration::minutes(1);
#[allow(deprecated)]
pub const SECOND: chrono::Duration = chrono::Duration::seconds(1);
#[allow(deprecated)]
pub const HOUR: chrono::Duration = chrono::Duration::hours(1);
pub fn seconds(seconds: i64) -> anyhow::Result<chrono::Duration> {
chrono::Duration::try_seconds(seconds).ok_or_else(|| {
anyhow::anyhow!("{seconds} is out of range for chrono::Duration::try_seconds")
})
}
pub fn minutes(minutes: i64) -> anyhow::Result<chrono::Duration> {
chrono::Duration::try_minutes(minutes).ok_or_else(|| {
anyhow::anyhow!("{minutes} is out of range for chrono::Duration::try_minutes")
})
}
pub fn days(days: i64) -> anyhow::Result<chrono::Duration> {
chrono::Duration::try_days(days)
.ok_or_else(|| anyhow::anyhow!("{days} is out of range for chrono::Duration::try_days"))
}