feat(elements): able to convert Datetime into Utc
This commit is contained in:
parent
7d838b4c03
commit
94360097a8
|
@ -66,6 +66,12 @@ mod chrono {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Into<DateTime<Utc>> for Datetime<'_> {
|
||||||
|
fn into(self) -> DateTime<Utc> {
|
||||||
|
(&self).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Into<NaiveDate> for &Datetime<'_> {
|
impl Into<NaiveDate> for &Datetime<'_> {
|
||||||
fn into(self) -> NaiveDate {
|
fn into(self) -> NaiveDate {
|
||||||
NaiveDate::from_ymd(self.year.into(), self.month.into(), self.day.into())
|
NaiveDate::from_ymd(self.year.into(), self.month.into(), self.day.into())
|
||||||
|
@ -87,6 +93,12 @@ mod chrono {
|
||||||
NaiveDateTime::new(self.into(), self.into())
|
NaiveDateTime::new(self.into(), self.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Into<DateTime<Utc>> for &Datetime<'_> {
|
||||||
|
fn into(self) -> DateTime<Utc> {
|
||||||
|
DateTime::from_utc(self.into(), Utc)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(test, derive(PartialEq))]
|
#[cfg_attr(test, derive(PartialEq))]
|
||||||
|
|
Loading…
Reference in a new issue