Skip to content

Commit 245ef9e

Browse files
authored
Merge pull request #10 from Dowwie/master
added support for chrono::Datetime<TimeZone> , featuring Utc and Local
2 parents a175981 + f2cba67 commit 245ef9e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ documentation = "https://sfackler.github.io/rust-postgres-range/doc/v0.9.0/postg
1111
time = "0.1"
1212
postgres = "0.15"
1313
postgres-protocol = "0.3"
14+
chrono = "0.4.0"
15+
postgres-shared = { version = "0.4.0", features = ["with-chrono"] }
1416

1517
[dev-dependencies]
16-
postgres = { version = "0.15", features = ["with-time"] }
18+
postgres = { version = "0.15", features = ["with-time"] }

src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
#[macro_use(to_sql_checked)]
55
extern crate postgres;
66
extern crate postgres_protocol;
7+
extern crate postgres_shared;
78
extern crate time;
9+
extern crate chrono;
10+
use chrono::{DateTime, TimeZone};
811

912
use std::cmp::Ordering;
1013
use std::fmt;
@@ -155,6 +158,17 @@ impl Normalizable for Timespec {
155158
}
156159
}
157160

161+
impl<T> Normalizable for DateTime<T>
162+
where T: TimeZone {
163+
fn normalize<S>(bound: RangeBound<S, DateTime<T>>) -> RangeBound<S, DateTime<T>>
164+
where
165+
S: BoundSided,
166+
{
167+
bound
168+
}
169+
}
170+
171+
158172
/// The possible sides of a bound.
159173
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
160174
pub enum BoundSide {

0 commit comments

Comments
 (0)