From b4428c27c605ef89d7231096d15851ebfd9bfede Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Fri, 29 Sep 2023 17:49:38 +0100 Subject: support timezones in calendar (#1259) --- atuin-server-postgres/src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'atuin-server-postgres/src') diff --git a/atuin-server-postgres/src/lib.rs b/atuin-server-postgres/src/lib.rs index c71d03ae..f22e6bee 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, ) -> DbResult { 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)?; -- cgit v1.3.1