-
Is there an elegant way to convert Situation: an API from an external library accepts a Current hacky solution: let input_time = datetime!(2000-01-01 0:00 +0);
let converted = PrimitiveDateTime(input_time.date(), input_time.time());
some_external_api(converted); I am asking this question because there exists an elegant way to convert |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That is currently the best solution. I have been extremely hesitant to add an API for this, as I feel it will be very error prone. I just had an idea that may work — |
Beta Was this translation helpful? Give feedback.
That is currently the best solution. I have been extremely hesitant to add an API for this, as I feel it will be very error prone. I just had an idea that may work —
fn to_primitive_with_offset(self) -> (PrimitiveDateTime, UtcOffset)
as a method onOffsetDateTime
. But I also just woke up, so we'll see how I feel about it later.