diff --git a/src/naive/date.rs b/src/naive/date.rs index 4fabd73809..eaea2648ef 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -1828,6 +1828,12 @@ impl Sub for NaiveDate { } } +impl From for NaiveDate { + fn from(naive_datetime: NaiveDateTime) -> Self { + naive_datetime.date() + } +} + /// Iterator over `NaiveDate` with a step size of one day. #[derive(Debug, Copy, Clone, Hash, PartialEq, PartialOrd, Eq, Ord)] pub struct NaiveDateDaysIterator {