diff options
author | Conrad Ludgate <conradludgate@gmail.com> | 2023-09-29 17:49:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 17:49:38 +0100 |
commit | b4428c27c605ef89d7231096d15851ebfd9bfede (patch) | |
tree | 9a905f1ce2b8484d01e4ea8c13df65c664181c52 /atuin-server-postgres | |
parent | a195c389b6aa4002637a6c5185e27353a1f3d8dc (diff) |
support timezones in calendar (#1259)
Diffstat (limited to 'atuin-server-postgres')
-rw-r--r-- | atuin-server-postgres/src/lib.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/atuin-server-postgres/src/lib.rs b/atuin-server-postgres/src/lib.rs index c71d03ae9..f22e6bee3 100644 --- a/atuin-server-postgres/src/lib.rs +++ b/atuin-server-postgres/src/lib.rs @@ -1,3 +1,5 @@ +use std::ops::Range; + use async_trait::async_trait; use atuin_common::record::{EncryptedData, HostId, Record, RecordId, RecordIndex}; use atuin_server_database::models::{History, NewHistory, NewSession, NewUser, Session, User}; @@ -176,8 +178,7 @@ impl Database for Postgres { async fn count_history_range( &self, user: &User, - start: PrimitiveDateTime, - end: PrimitiveDateTime, + range: Range<OffsetDateTime>, ) -> DbResult<i64> { let res: (i64,) = sqlx::query_as( "select count(1) from history @@ -186,8 +187,8 @@ impl Database for Postgres { and timestamp < $3::date", ) .bind(user.id) - .bind(start) - .bind(end) + .bind(into_utc(range.start)) + .bind(into_utc(range.end)) .fetch_one(&self.pool) .await .map_err(fix_error)?; |