pub(super) fn timestamp(odt: time::OffsetDateTime) -> Result<jiff::Timestamp, String> {
jiff::Timestamp::new(odt.unix_timestamp(), odt.nanosecond() as i32).map_err(|e| e.to_string())
}
pub(super) fn date(d: time::Date) -> Result<jiff::civil::Date, String> {
let year = i16::try_from(d.year()).map_err(|e| e.to_string())?;
jiff::civil::Date::new(year, u8::from(d.month()) as i8, d.day() as i8).map_err(|e| e.to_string())
}
pub(super) fn time_of_day(t: time::Time) -> jiff::civil::Time {
jiff::civil::Time::constant(
t.hour() as i8,
t.minute() as i8,
t.second() as i8,
t.nanosecond() as i32,
)
}
pub(super) fn datetime(dt: time::PrimitiveDateTime) -> Result<jiff::civil::DateTime, String> {
Ok(date(dt.date())?.to_datetime(time_of_day(dt.time())))
}