From 0afdb0b34eeefff033819f4f0930c960af8e17f8 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Mon, 10 Dec 2018 15:30:03 +0100 Subject: Implement PartialOrd for dates and events --- src/date.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/date.rs') diff --git a/src/date.rs b/src/date.rs index 8d41c67..45a0c28 100644 --- a/src/date.rs +++ b/src/date.rs @@ -9,7 +9,7 @@ use chrono::offset::Utc; use chrono_tz::{Tz, UTC}; -#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Date { Time(chrono::DateTime), AllDay(chrono::Date), @@ -109,6 +109,12 @@ impl Ord for Date { } } +impl PartialOrd for Date { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + impl Add for Date { type Output = Date; -- cgit v1.2.3