You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My question is: Is this the behaviour we want to have in this crate going forward? If not I am happy to open a PR to fix this and return values as NaiveDateTimes/Dates in rust.
The text was updated successfully, but these errors were encountered:
Makes sense to me not to depend on chrono and leave the existing behavior as is. It's an easy conversion after all, and you can use any of the datetime crates you like.
For future peeps struggling to convert types, here is a snippet from my json conversion code:
duckdb::types::Value::Date32(i) => {// From experimentation, this is number of days since 1970-01-01.// Chrono uses 0001-01-01 as the epoch, so we need to add 719163// days to get the correct date.let nd = NaiveDate::from_num_days_from_ce_opt(i + 719163).ok_or(anyhow!("Error converting duckdb::types::Value::Date32 to chrono::NaiveDate. amount: {:?}",
i
))?;
serde_json::Value::String(nd.to_string())}
I was running into issues querying dates in my code, and I found this stackoverflow thread: https://stackoverflow.com/questions/78576383/how-to-fetch-datetime-type-correctly-from-duckdb-using-rust
It perfectly describes my case.
My question is: Is this the behaviour we want to have in this crate going forward? If not I am happy to open a PR to fix this and return values as NaiveDateTimes/Dates in rust.
The text was updated successfully, but these errors were encountered: