From 0aba65b339973bb4346e7c4c2a27b1892d274a32 Mon Sep 17 00:00:00 2001 From: pezcore <tvboyd23@gmail.com> Date: Thu, 6 Apr 2023 18:42:55 -0400 Subject: [PATCH] add impl From<NaiveDateTime> for NaiveDate --- src/naive/date.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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<NaiveDate> for NaiveDate { } } +impl From<NaiveDateTime> 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 {