Skip to content

Commit

Permalink
Prefer and_local_timezone in map_local
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jul 20, 2023
1 parent b926bc1 commit 1cb303d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ fn map_local<Tz: TimeZone, F>(dt: &DateTime<Tz>, mut f: F) -> Option<DateTime<Tz
where
F: FnMut(NaiveDateTime) -> Option<NaiveDateTime>,
{
f(dt.naive_local()).and_then(|datetime| dt.timezone().from_local_datetime(&datetime).single())
f(dt.naive_local()).and_then(|datetime| datetime.and_local_timezone(dt.timezone()).single())
}

impl DateTime<FixedOffset> {
Expand Down

0 comments on commit 1cb303d

Please sign in to comment.