Skip to content

Elegant way to convert OffsetDateTime to PrimitiveDateTime #472

Closed Answered by jhpratt
liushuyu asked this question in Question
Discussion options

You must be logged in to vote

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 on OffsetDateTime. But I also just woke up, so we'll see how I feel about it later.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jhpratt
Comment options

Answer selected by liushuyu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants