From ad8644ea57103f186587cd54719a9ecf511ee1b0 Mon Sep 17 00:00:00 2001 From: Dunja Lalic Date: Mon, 16 Dec 2019 12:53:36 +0100 Subject: [PATCH] Fixes #354 --- src/datetime.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/datetime.rs b/src/datetime.rs index 074b973..1e53753 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -575,8 +575,8 @@ impl PartialEq> for DateTime { impl Eq for DateTime { } -impl PartialOrd for DateTime { - fn partial_cmp(&self, other: &DateTime) -> Option { +impl PartialOrd> for DateTime { + fn partial_cmp(&self, other: &DateTime) -> Option { self.datetime.partial_cmp(&other.datetime) } } @@ -2032,6 +2032,9 @@ mod tests { assert_eq!(d.date(), tz.ymd(2017, 8, 9)); assert_eq!(d.date().naive_local(), NaiveDate::from_ymd(2017, 8, 9)); assert_eq!(d.date().and_time(d.time()), Some(d)); + + let utc_d = Utc.ymd(2017, 8, 9).and_hms(12, 34, 56); + assert!(utc_d < d); } #[test]