Skip to content

Commit

Permalink
add impl From<NaiveDateTime> for NaiveDate
Browse files Browse the repository at this point in the history
  • Loading branch information
pezcore authored and djc committed May 11, 2023
1 parent 8df1ba1 commit 005ec07
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/naive/date.rs
Expand Up @@ -1831,6 +1831,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 {
Expand Down

0 comments on commit 005ec07

Please sign in to comment.