diff --git a/src/datetime.rs b/src/datetime.rs index 2e55306..123e10e 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -235,6 +235,43 @@ impl DateTime { } } +impl From> for DateTime { + fn from(src: DateTime) -> Self { + src.with_timezone(&FixedOffset::east(0)) + } +} + +impl From> for DateTime { + fn from(src: DateTime) -> Self { + src.with_timezone(&Local) + } +} + +impl From> for DateTime { + fn from(src: DateTime) -> Self { + src.with_timezone(&Utc) + } +} + +impl From> for DateTime { + fn from(src: DateTime) -> Self { + src.with_timezone(&Local) + } +} + +impl From> for DateTime { + fn from(src: DateTime) -> Self { + src.with_timezone(&Utc) + } +} + +impl From> for DateTime { + fn from(src: DateTime) -> Self { + // todo: return in actual current local offset Tz + src.with_timezone(&FixedOffset::east(0)) + } +} + /// Maps the local datetime to other datetime with given conversion function. fn map_local(dt: &DateTime, mut f: F) -> Option> where F: FnMut(NaiveDateTime) -> Option {