Skip to content

Commit

Permalink
improved impl (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Billy-Sheppard authored Sep 17, 2024
1 parent e3334ed commit 4e2f8bf
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/day.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,18 @@ impl crate::DateResolution for Day {
}
}

impl From<DateTime<Utc>> for Day {
fn from(d: DateTime<Utc>) -> Self {
d.date_naive().into()
}
}

impl From<NaiveDate> for Day {
fn from(value: NaiveDate) -> Day {
Day::from_date(value, ())
// impl From<DateTime<Utc>> for Day {
// fn from(d: DateTime<Utc>) -> Self {
// d.date_naive().into()
// }
// }

impl<D: Datelike> From<D> for Day {
fn from(value: D) -> Day {
Day::from_date(
chrono::NaiveDate::from_ymd_opt(value.year(), value.month(), value.day()).unwrap(),
(),
)
}
}

Expand Down

0 comments on commit 4e2f8bf

Please sign in to comment.