From 005ec07f45e814cc02487293b769ca49d5841ebc Mon Sep 17 00:00:00 2001 From: pezcore Date: Thu, 6 Apr 2023 18:42:55 -0400 Subject: [PATCH] add impl From 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 c2bf145ea7..c5b6fe0d74 100644 --- a/src/naive/date.rs +++ b/src/naive/date.rs @@ -1831,6 +1831,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 {