Skip to content

Commit

Permalink
Use correct offset in conversion from Local to FixedOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker authored and djc committed May 12, 2023
1 parent 595955c commit 6a37b4c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,9 @@ impl From<DateTime<Local>> for DateTime<Utc> {
impl From<DateTime<Local>> for DateTime<FixedOffset> {
/// Convert this `DateTime<Local>` instance into a `DateTime<FixedOffset>` instance.
///
/// Conversion is performed via [`DateTime::with_timezone`]. Note that the converted value returned
/// by this will be created with a fixed timezone offset of 0.
/// Conversion is performed via [`DateTime::with_timezone`].
fn from(src: DateTime<Local>) -> Self {
src.with_timezone(&FixedOffset::east_opt(0).unwrap())
src.with_timezone(&src.offset().fix())
}
}

Expand Down

0 comments on commit 6a37b4c

Please sign in to comment.