How does one convert between DateTime<FixedOffset> and DateTime<Tz>, in order to subtract to get a duration, compare inequality, or reassign?
An attempt to do this directly yields the error:
mismatched types
expected struct `DateTime<FixedOffset>`
found struct `DateTime<Tz>`rustcE0308
Obligatory MRE:
let mut a = DateTime::parse_from_rfc3339("2022-06-01T10:00:00").unwrap();
let b = a.with_timezone(&New_York);
a = b
>Solution :
Convert the timezone of b into the timezone of a before assigning it:
a = b.with_timezone(&a.timezone());