Fixes #354
This commit is contained in:
parent
b9cd0ce803
commit
ad8644ea57
|
@ -575,8 +575,8 @@ impl<Tz: TimeZone, Tz2: TimeZone> PartialEq<DateTime<Tz2>> for DateTime<Tz> {
|
||||||
impl<Tz: TimeZone> Eq for DateTime<Tz> {
|
impl<Tz: TimeZone> Eq for DateTime<Tz> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Tz: TimeZone> PartialOrd for DateTime<Tz> {
|
impl<Tz: TimeZone, Tz2: TimeZone> PartialOrd<DateTime<Tz2>> for DateTime<Tz> {
|
||||||
fn partial_cmp(&self, other: &DateTime<Tz>) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &DateTime<Tz2>) -> Option<Ordering> {
|
||||||
self.datetime.partial_cmp(&other.datetime)
|
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(), tz.ymd(2017, 8, 9));
|
||||||
assert_eq!(d.date().naive_local(), NaiveDate::from_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));
|
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]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue